Add instructeurs to groupe
This commit is contained in:
parent
3dd3af8482
commit
a6deafd885
6 changed files with 99 additions and 1 deletions
|
@ -83,4 +83,33 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
|||
it { expect(flash.alert).to be_present }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#add_instructeur' do
|
||||
let!(:instructeur) { create(:instructeur) }
|
||||
before do
|
||||
gi_1_1.instructeurs << instructeur
|
||||
|
||||
post :add_instructeur,
|
||||
params: {
|
||||
procedure_id: procedure.id,
|
||||
id: gi_1_1.id,
|
||||
instructeur: { email: new_instructeur_email }
|
||||
}
|
||||
end
|
||||
|
||||
context 'of a new instructeur' do
|
||||
let(:new_instructeur_email) { 'new_instructeur@mail.com' }
|
||||
|
||||
it { expect(gi_1_1.instructeurs.pluck(:email)).to include(new_instructeur_email) }
|
||||
it { expect(flash.notice).to be_present }
|
||||
it { expect(response).to redirect_to(procedure_groupe_instructeur_path(procedure, gi_1_1)) }
|
||||
end
|
||||
|
||||
context 'of an instructeur already in the group' do
|
||||
let(:new_instructeur_email) { instructeur.email }
|
||||
|
||||
it { expect(flash.alert).to be_present }
|
||||
it { expect(response).to redirect_to(procedure_groupe_instructeur_path(procedure, procedure.defaut_groupe_instructeur)) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue