2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-21 18:56:01 +02:00
|
|
|
require 'system/administrateurs/procedure_spec_helper'
|
|
|
|
|
2023-11-06 15:15:51 +01:00
|
|
|
describe 'Manage procedure instructeurs', js: true do
|
2022-07-21 18:56:01 +02:00
|
|
|
include ProcedureSpecHelper
|
|
|
|
|
2024-06-01 22:50:48 +02:00
|
|
|
let(:administrateur) { administrateurs(:default_admin) }
|
|
|
|
let(:procedure) { create(:procedure) }
|
2022-07-21 18:56:01 +02:00
|
|
|
let(:manager) { false }
|
|
|
|
before do
|
2024-06-01 22:50:48 +02:00
|
|
|
procedure.administrateurs_procedures.update_all(manager:)
|
2022-07-21 18:56:01 +02:00
|
|
|
login_as administrateur.user, scope: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'is accessible via card' do
|
|
|
|
let(:manager) { false }
|
|
|
|
|
|
|
|
scenario 'it works' do
|
|
|
|
visit admin_procedure_path(procedure)
|
|
|
|
find('#groupe-instructeurs').click
|
2024-05-28 10:58:03 +02:00
|
|
|
expect(page).to have_css("h1", text: "Instructeurs")
|
2022-07-21 18:56:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'as admin from manager' do
|
|
|
|
let(:manager) { true }
|
|
|
|
|
|
|
|
scenario 'cannot add instructeur' do
|
|
|
|
visit admin_procedure_groupe_instructeurs_path(procedure)
|
|
|
|
|
|
|
|
expect(page).to have_css("#instructeur_emails[disabled=\"disabled\"]")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|