test fonctionnel notifications avis
This commit is contained in:
parent
bfd24e8aee
commit
52d5a52ff9
1 changed files with 82 additions and 63 deletions
|
@ -445,12 +445,26 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:emails) { ['email@a.com'] }
|
||||||
|
|
||||||
|
context "notifications updates" do
|
||||||
|
context 'when an instructeur follows the dossier' do
|
||||||
|
let(:follower) { create(:instructeur) }
|
||||||
|
before { follower.follow(dossier) }
|
||||||
|
|
||||||
|
it 'the follower has a notification' do
|
||||||
|
expect(follower.followed_dossiers.with_notifications(follower)).to eq([])
|
||||||
|
subject
|
||||||
|
expect(follower.followed_dossiers.with_notifications(follower)).to eq([dossier.reload])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'email sending' do
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:emails) { ['email@a.com'] }
|
|
||||||
|
|
||||||
it { expect(saved_avis.email).to eq('email@a.com') }
|
it { expect(saved_avis.email).to eq('email@a.com') }
|
||||||
it { expect(saved_avis.introduction).to eq('intro') }
|
it { expect(saved_avis.introduction).to eq('intro') }
|
||||||
it { expect(saved_avis.confidentiel).to eq(true) }
|
it { expect(saved_avis.confidentiel).to eq(true) }
|
||||||
|
@ -461,6 +475,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
context "with an invalid email" do
|
context "with an invalid email" do
|
||||||
let(:emails) { ['emaila.com'] }
|
let(:emails) { ['emaila.com'] }
|
||||||
|
|
||||||
|
before { subject }
|
||||||
|
|
||||||
it { expect(response).to render_template :avis }
|
it { expect(response).to render_template :avis }
|
||||||
it { expect(flash.alert).to eq(["emaila.com : Email n'est pas valide"]) }
|
it { expect(flash.alert).to eq(["emaila.com : Email n'est pas valide"]) }
|
||||||
it { expect { subject }.not_to change(Avis, :count) }
|
it { expect { subject }.not_to change(Avis, :count) }
|
||||||
|
@ -470,6 +486,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
context 'with multiple emails' do
|
context 'with multiple emails' do
|
||||||
let(:emails) { ["toto.fr,titi@titimail.com"] }
|
let(:emails) { ["toto.fr,titi@titimail.com"] }
|
||||||
|
|
||||||
|
before { subject }
|
||||||
|
|
||||||
it { expect(response).to render_template :avis }
|
it { expect(response).to render_template :avis }
|
||||||
it { expect(flash.alert).to eq(["toto.fr : Email n'est pas valide"]) }
|
it { expect(flash.alert).to eq(["toto.fr : Email n'est pas valide"]) }
|
||||||
it { expect(flash.notice).to eq("Une demande d'avis a été envoyée à titi@titimail.com") }
|
it { expect(flash.notice).to eq("Une demande d'avis a été envoyée à titi@titimail.com") }
|
||||||
|
@ -481,7 +499,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
let(:asked_confidentiel) { false }
|
let(:asked_confidentiel) { false }
|
||||||
let(:previous_avis_confidentiel) { false }
|
let(:previous_avis_confidentiel) { false }
|
||||||
let(:dossier) { create(:dossier, :en_construction, :with_dossier_link, procedure: procedure) }
|
let(:dossier) { create(:dossier, :en_construction, :with_dossier_link, procedure: procedure) }
|
||||||
|
before { subject }
|
||||||
context 'when the expert doesn’t share linked dossiers' do
|
context 'when the expert doesn’t share linked dossiers' do
|
||||||
let(:invite_linked_dossiers) { false }
|
let(:invite_linked_dossiers) { false }
|
||||||
|
|
||||||
|
@ -528,6 +546,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#show" do
|
describe "#show" do
|
||||||
context "when the dossier is exported as PDF" do
|
context "when the dossier is exported as PDF" do
|
||||||
|
|
Loading…
Add table
Reference in a new issue