Skip to content

Commit

Permalink
Merge pull request #2295 from rspec/reword-specs
Browse files Browse the repository at this point in the history
Reword mailer specs doc strings for ensuring deliveries are cleared
  • Loading branch information
JonRowe committed Mar 24, 2020
1 parent ee99c11 commit a597994
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/rspec/rails/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ def self.application; end
expect(group.new).to be_a(RSpec::Rails::MailerExampleGroup)
end

describe 'leans test mailbox after each example' do
let(:base_mailer) do
describe 'clears ActionMailer::Base::Deliveries after each example' do
let(:mailer) do
Class.new(ActionMailer::Base) do
default from: 'from@example.com'

Expand All @@ -272,14 +272,14 @@ def welcome(to:)
ActionMailer::Base.delivery_method = :test
end

it 'send to email@' do
base_mailer.welcome(to: 'email@example.com').deliver_now
it 'only has deliveries from this test (e.g. from email@example.com)' do
mailer.welcome(to: 'email@example.com').deliver_now

expect(ActionMailer::Base.deliveries.map(&:to).flatten.sort).to eq(['email@example.com'])
end

it 'send to email_2@' do
base_mailer.welcome(to: 'email_2@example.com').deliver_now
it 'only has deliveries from this test (e.g. from email_2@example.com)' do
mailer.welcome(to: 'email_2@example.com').deliver_now

expect(ActionMailer::Base.deliveries.map(&:to).flatten.sort).to eq(['email_2@example.com'])
end
Expand Down

0 comments on commit a597994

Please sign in to comment.