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

Removed mocha from ActionMailer #21306

Merged
merged 1 commit into from Aug 20, 2015

Conversation

ronakjangir47
Copy link
Contributor

\cc @kaspth

@@ -102,16 +102,21 @@ def welcome(hash={})
end

test "ActionMailer should be told when Mail gets delivered" do
DeliveryMailer.expects(:deliver_mail).once
DeliveryMailer.welcome.deliver_now
DeliveryMailer.delivery_method = :test
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't delivery method be test by default? I'd rather if we found a way not to set it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default delivery_method is smtp, so it's trying to deliver email. I'm getting the following error because of it

MailDeliveryTest#test_ActionMailer_should_be_told_when_Mail_gets_delivered:
Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 25

So either we have to set delivery_method :test or we have to stub any instance Mail::SMTP.
WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was worried that changing the delivery_method would spill over into other tests, but the setup and teardown makes sure to keep the old delivery method: https://github.com/rails/rails/pull/21306/files#diff-db5e616c1ed1b103bd61d787ad6cf567R100

So there's no problem.

kaspth added a commit that referenced this pull request Aug 20, 2015
@kaspth kaspth merged commit 86e0136 into rails:master Aug 20, 2015
@kaspth
Copy link
Contributor

kaspth commented Aug 20, 2015

Thanks

@ronakjangir47 ronakjangir47 deleted the remove_mocha_actionmailer branch August 21, 2015 06:08
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.

None yet

2 participants