diff options
author | Jakub Kuźma <kuba@jah.pl> | 2012-07-09 11:53:22 +0200 |
---|---|---|
committer | Jakub Kuźma <kuba@jah.pl> | 2012-07-09 11:53:22 +0200 |
commit | ad1c447a99bcad751a10226262666d7c978279ee (patch) | |
tree | 197e2bf60504db16f3d2ae356bef0cc45b9b0ae1 /guides/source/action_mailer_basics.textile | |
parent | 8139daa77bbf0d66dc78587d8e8871fcf7ca87bb (diff) | |
download | rails-ad1c447a99bcad751a10226262666d7c978279ee.tar.gz rails-ad1c447a99bcad751a10226262666d7c978279ee.tar.bz2 rails-ad1c447a99bcad751a10226262666d7c978279ee.zip |
It's better to pass strings to assert_match - it converts them to regular expressions, escaping special chars like '.'. It seems email.encoded contains some unexpected line breaks (due to encoding), it's better to assert_match email.body.to_s.
Diffstat (limited to 'guides/source/action_mailer_basics.textile')
-rw-r--r-- | guides/source/action_mailer_basics.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/action_mailer_basics.textile b/guides/source/action_mailer_basics.textile index 7c61cc4a8d..07fbc9c7a1 100644 --- a/guides/source/action_mailer_basics.textile +++ b/guides/source/action_mailer_basics.textile @@ -508,8 +508,8 @@ class UserMailerTest < ActionMailer::TestCase # Test the body of the sent email contains what we expect it to assert_equal [user.email], email.to assert_equal "Welcome to My Awesome Site", email.subject - assert_match(/<h1>Welcome to example.com, #{user.name}<\/h1>/, email.encoded) - assert_match(/Welcome to example.com, #{user.name}/, email.encoded) + assert_match "<h1>Welcome to example.com, #{user.name}</h1>", email.body.to_s + assert_match "Welcome to example.com, #{user.name}", email.body.to_s end end </ruby> |