fix test
This commit is contained in:
parent
3cf3dc4623
commit
fae81d0a58
3 changed files with 5 additions and 5 deletions
|
@ -27,14 +27,14 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
|
|
||||||
describe 'remind' do
|
describe 'remind' do
|
||||||
before do
|
before do
|
||||||
allow(AvisMailer).to receive(:avis_invitation).and_return(double(deliver_later: nil))
|
allow(AvisMailer).to receive(:avis_invitation_and_confirm_email).and_return(double(deliver_later: nil))
|
||||||
end
|
end
|
||||||
context 'without question' do
|
context 'without question' do
|
||||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
||||||
|
|
||||||
it 'sends a reminder to the expert' do
|
it 'sends a reminder to the expert' do
|
||||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
||||||
expect(AvisMailer).to have_received(:avis_invitation).once.with(avis)
|
expect(AvisMailer).to have_received(:avis_invitation_and_confirm_email)
|
||||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||||
expect(avis.reload.reminded_at).to be_present
|
expect(avis.reload.reminded_at).to be_present
|
||||||
end
|
end
|
||||||
|
@ -45,7 +45,7 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
|
|
||||||
it 'sends a reminder to the expert' do
|
it 'sends a reminder to the expert' do
|
||||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
||||||
expect(AvisMailer).to have_received(:avis_invitation).once.with(avis)
|
expect(AvisMailer).to have_received(:avis_invitation_and_confirm_email)
|
||||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||||
expect(avis.reload.reminded_at).to be_present
|
expect(avis.reload.reminded_at).to be_present
|
||||||
end
|
end
|
||||||
|
|
|
@ -81,7 +81,7 @@ describe Users::ActivateController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to root path with an explanation notice and it send a new link if user present' do
|
it 'redirects to root path with an explanation notice and it send a new link if user present' do
|
||||||
expect { subject }.to have_enqueued_mail(UserMailer, :invite_tiers)
|
expect { subject }.to have_enqueued_mail(UserMailer, :resend_confirmation_email)
|
||||||
expect(response).to redirect_to(root_path(user))
|
expect(response).to redirect_to(root_path(user))
|
||||||
expect(flash[:alert]).to eq("Ce lien n'est plus valable, un nouveau lien a été envoyé à l'adresse #{user.email}")
|
expect(flash[:alert]).to eq("Ce lien n'est plus valable, un nouveau lien a été envoyé à l'adresse #{user.email}")
|
||||||
end
|
end
|
||||||
|
|
|
@ -191,7 +191,7 @@ describe User, type: :model do
|
||||||
user = subject
|
user = subject
|
||||||
expect(user.valid_password?(password)).to be true
|
expect(user.valid_password?(password)).to be true
|
||||||
expect(user.confirmed_at).to be_present
|
expect(user.confirmed_at).to be_present
|
||||||
expect(user.email_verified_at).to be_present
|
expect(user.email_verified_at).to be_nil
|
||||||
expect(user.expert).to be_present
|
expect(user.expert).to be_present
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue