Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear test mailbox from ActionMailer::Base between each example #2293

Merged
merged 4 commits into from Mar 20, 2020

Conversation

benoittgt
Copy link
Member

We notice in #2290 that
ActionMailer::Base.deliveries mailbox is not cleaned between example.

Fix: #2290

We notice in #2290 that
ActionMailer::Base.deliveries mailbox is not cleaned between example.

Fix: #2290
@@ -256,6 +256,31 @@ def self.application; end
expect(group.mailer_class).to be(a_mailer_class)
expect(group.new).to be_a(RSpec::Rails::MailerExampleGroup)
end

describe 'cleans test mailbox between each example in all rspec-rails example' do
class BaseMailer < ActionMailer::Base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be an anonymous class in a let?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! Good idea

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain you prefer?

Done with 368484b

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean! LGTM

spec/rspec/rails/configuration_spec.rb Outdated Show resolved Hide resolved
@pirj
Copy link
Member

pirj commented Mar 20, 2020

Does this fix the problem you're experiencing @cunknown?

@pirj
Copy link
Member

pirj commented Mar 20, 2020

JRuby failures are unrelated, fixed on JRuby master.
Cleared Travis cache for the branch and PR, restarted JRuby jobs.

@benoittgt
Copy link
Member Author

Does this fix the problem you're experiencing @cunknown?

It has been tested against the repo provided + the test I wrote with the mailer service.

@pirj
Copy link
Member

pirj commented Mar 20, 2020

jruby-head on Travis seems to be 10h old (74.22 MiB, 2020-03-20 11:41:48 UTC), while the fix is from 3h ago. I don't see a good reason to wait for it to update.

@benoittgt Changelog?

@benoittgt benoittgt merged commit 2865832 into master Mar 20, 2020
@benoittgt benoittgt deleted the clear-actionmailer-deliveries branch March 20, 2020 23:02
@benoittgt
Copy link
Member Author

🙏 Thank you!

@@ -18,6 +18,7 @@ Bug Fixes:
(Jonathan Rochkind, #2242)
* `rails generate generator` command now creates related spec file (Joel Azemar, #2217)
* Relax upper `capybara` version constraint to allow for Capybara 3.x (Phil Pirozhkov, #2281)
* Leans ActionMailer test mailbox after each example (Benoit Tigeot, #2293)
Copy link
Member

@pirj pirj Mar 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleans :D

JonRowe pushed a commit that referenced this pull request Mar 24, 2020
JonRowe added a commit that referenced this pull request Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible regression 4.0.0.beta4 to 4.0.0.rc1: List of ActionMailer deliveries is not cleared between specs
3 participants