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

assert_emails in block form use the given number as expected value #20085

Merged
merged 1 commit into from
May 9, 2015
Merged

assert_emails in block form use the given number as expected value #20085

merged 1 commit into from
May 9, 2015

Conversation

y-yagi
Copy link
Member

@y-yagi y-yagi commented May 9, 2015

In assert_equal calling in assert_email, appoint the value that added original count and number to. However, appoint only number in error message.

Therefore, when call deliver_now before calling assert_equal, output is different from Expected in error message.

test "notifier mail" do
  NotifierMailer.welcome.deliver_now
  assert_emails 2 do
    NotifierMailer.welcome.deliver_now
  end
end
  1) Failure:
NotifierMailerTest#test_notifier_mail [/home/yaginuma/program/rails/master/test/mailers/notifier_mailer_test.rb:6]:
2 emails expected, but 1 were sent.
Expected: 3
  Actual: 2

This patch fixes the argument of assert_equal, so it's output as follows.

  1) Failure:
NotifierMailerTest#test_notifier_mail [/home/yaginuma/program/rails/master/test/mailers/notifier_mailer_test.rb:6]:
2 emails expected, but 1 were sent.
Expected: 2
  Actual: 1

senny added a commit that referenced this pull request May 9, 2015
`assert_emails` in block form use the given number as expected value
@senny senny merged commit 9c35f57 into rails:master May 9, 2015
@senny
Copy link
Member

senny commented May 9, 2015

@y-yagi thank you 💛

senny added a commit that referenced this pull request May 9, 2015
`assert_emails` in block form use the given number as expected value
@y-yagi
Copy link
Member Author

y-yagi commented May 9, 2015

@senny Thanks!

@y-yagi y-yagi deleted the improve_assert_emails_msg branch May 9, 2015 10:36
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