Commit d8e86194 authored by Rémy Coutable's avatar Rémy Coutable

Fix and improve spec/workers/admin_emails_worker_spec.rb

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent ac661769
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
describe AdminEmailsWorker do describe AdminEmailsWorker do
context "recipients" do context "recipients" do
let(:group) { create :group } let(:group) { create(:group) }
let(:project) { create :project } let(:project) { create(:project) }
before do before do
2.times do 2.times do
...@@ -26,8 +26,9 @@ describe AdminEmailsWorker do ...@@ -26,8 +26,9 @@ describe AdminEmailsWorker do
it "sends email to subscribed users" do it "sends email to subscribed users" do
perform_enqueued_jobs do perform_enqueued_jobs do
described_class.new.perform(recipient_id, 'subject', 'body') subject.perform(recipient_id, 'subject', 'body')
expect(ActionMailer::Base.deliveries.count).to be 2
expect(ActionMailer::Base.deliveries.count).to eq(2)
end end
end end
end end
...@@ -37,8 +38,9 @@ describe AdminEmailsWorker do ...@@ -37,8 +38,9 @@ describe AdminEmailsWorker do
it "sends email to subscribed users" do it "sends email to subscribed users" do
perform_enqueued_jobs do perform_enqueued_jobs do
described_class.new.perform(recipient_id, 'subject', 'body') subject.perform(recipient_id, 'subject', 'body')
expect(ActionMailer::Base.deliveries.count).to be 3
expect(ActionMailer::Base.deliveries.count).to eq(3)
end end
end end
end end
...@@ -48,8 +50,9 @@ describe AdminEmailsWorker do ...@@ -48,8 +50,9 @@ describe AdminEmailsWorker do
it "sends email to subscribed users" do it "sends email to subscribed users" do
perform_enqueued_jobs do perform_enqueued_jobs do
described_class.new.perform(recipient_id, 'subject', 'body') subject.perform(recipient_id, 'subject', 'body')
expect(ActionMailer::Base.deliveries.count).to be 4
expect(ActionMailer::Base.deliveries.count).to eq(3)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment