Groupe instructeur selector default blank
This commit is contained in:
parent
9c3e72c84a
commit
70500e3d56
11 changed files with 124 additions and 69 deletions
|
@ -342,6 +342,7 @@ describe Users::DossiersController, type: :controller do
|
|||
{
|
||||
id: dossier.id,
|
||||
dossier: {
|
||||
groupe_instructeur_id: dossier.groupe_instructeur_id,
|
||||
champs_attributes: {
|
||||
id: first_champ.id,
|
||||
value: value
|
||||
|
@ -418,19 +419,44 @@ describe Users::DossiersController, type: :controller do
|
|||
let(:another_group) { create(:groupe_instructeur, procedure: procedure) }
|
||||
let(:instructeur_of_dossier) { create(:instructeur) }
|
||||
let(:instructeur_in_another_group) { create(:instructeur) }
|
||||
let!(:dossier) { create(:dossier, groupe_instructeur: dossier_group, user: user) }
|
||||
|
||||
before do
|
||||
allow(DossierMailer).to receive(:notify_new_dossier_depose_to_instructeur).and_return(double(deliver_later: nil))
|
||||
create(:assign_to, instructeur: instructeur_of_dossier, procedure: dossier.procedure, instant_email_dossier_notifications_enabled: true, groupe_instructeur: dossier_group)
|
||||
create(:assign_to, instructeur: instructeur_in_another_group, procedure: dossier.procedure, instant_email_dossier_notifications_enabled: true, groupe_instructeur: another_group)
|
||||
context "and grope instructeur is set" do
|
||||
let!(:dossier) { create(:dossier, groupe_instructeur: dossier_group, user: user) }
|
||||
|
||||
before do
|
||||
allow(DossierMailer).to receive(:notify_new_dossier_depose_to_instructeur).and_return(double(deliver_later: nil))
|
||||
create(:assign_to, instructeur: instructeur_of_dossier, procedure: dossier.procedure, instant_email_dossier_notifications_enabled: true, groupe_instructeur: dossier_group)
|
||||
create(:assign_to, instructeur: instructeur_in_another_group, procedure: dossier.procedure, instant_email_dossier_notifications_enabled: true, groupe_instructeur: another_group)
|
||||
end
|
||||
|
||||
it "sends notification mail to instructeurs in the correct group instructeur" do
|
||||
subject
|
||||
|
||||
expect(DossierMailer).to have_received(:notify_new_dossier_depose_to_instructeur).once.with(dossier, instructeur_of_dossier.email)
|
||||
expect(DossierMailer).not_to have_received(:notify_new_dossier_depose_to_instructeur).with(dossier, instructeur_in_another_group.email)
|
||||
end
|
||||
end
|
||||
|
||||
it "sends notification mail to instructeurs in the correct group instructeur" do
|
||||
subject
|
||||
context "and groupe instructeur is not set" do
|
||||
let(:dossier) { create(:dossier, procedure: procedure, user: user) }
|
||||
let(:submit_payload) do
|
||||
{
|
||||
id: dossier.id,
|
||||
dossier: {
|
||||
champs_attributes: {
|
||||
id: first_champ.id,
|
||||
value: value
|
||||
}
|
||||
},
|
||||
submit_draft: false
|
||||
}
|
||||
end
|
||||
|
||||
expect(DossierMailer).to have_received(:notify_new_dossier_depose_to_instructeur).once.with(dossier, instructeur_of_dossier.email)
|
||||
expect(DossierMailer).not_to have_received(:notify_new_dossier_depose_to_instructeur).with(dossier, instructeur_in_another_group.email)
|
||||
it "can not submit" do
|
||||
subject
|
||||
|
||||
expect(flash.alert).to eq(['Le champ « Votre ville » doit être rempli'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -557,6 +583,7 @@ describe Users::DossiersController, type: :controller do
|
|||
{
|
||||
id: dossier.id,
|
||||
dossier: {
|
||||
groupe_instructeur_id: dossier.groupe_instructeur_id,
|
||||
champs_attributes: [
|
||||
{
|
||||
id: first_champ.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue