refactor(mail.delay): use simplier implementation using after_action to prevent email delivery with delay

This commit is contained in:
Martin 2021-11-16 15:12:05 +01:00
parent e48b6e0c1f
commit 8bbd77f89f
6 changed files with 29 additions and 48 deletions

View file

@ -87,7 +87,7 @@ describe Commentaire do
let(:commentaire) { CommentaireService.build(instructeur, dossier, body: "Mon commentaire") }
it "calls notify_user with delay so instructeur can destroy his comment in case of failure" do
expect(commentaire).to receive(:notify_user_with_delay)
expect(commentaire).to receive(:notify_user).with(wait: 5.minutes)
commentaire.save
end
end
@ -96,7 +96,7 @@ describe Commentaire do
let(:commentaire) { CommentaireService.build(expert, dossier, body: "Mon commentaire") }
it "calls notify_user" do
expect(commentaire).to receive(:notify_user)
expect(commentaire).to receive(:notify_user).with(no_args)
commentaire.save
end
end
@ -105,7 +105,7 @@ describe Commentaire do
let(:commentaire) { CommentaireService.build_with_email(CONTACT_EMAIL, dossier, body: "Mon commentaire") }
it "does not call notify_user" do
expect(commentaire).not_to receive(:notify_user)
expect(commentaire).not_to receive(:notify_user).with(no_args)
commentaire.save
end
end