Skip to content
This repository
Browse code

It's better to pass strings to assert_match - it converts them to reg…

…ular 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.
  • Loading branch information...
commit ad1c447a99bcad751a10226262666d7c978279ee 1 parent 8139daa
Kuba Kuźma authored July 09, 2012
4  guides/source/action_mailer_basics.textile
Source Rendered
@@ -508,8 +508,8 @@ class UserMailerTest < ActionMailer::TestCase
508 508
     # Test the body of the sent email contains what we expect it to
509 509
     assert_equal [user.email], email.to
510 510
     assert_equal "Welcome to My Awesome Site", email.subject
511  
-    assert_match(/<h1>Welcome to example.com, #{user.name}<\/h1>/, email.encoded)
512  
-    assert_match(/Welcome to example.com, #{user.name}/, email.encoded)
  511
+    assert_match "<h1>Welcome to example.com, #{user.name}</h1>", email.body.to_s
  512
+    assert_match "Welcome to example.com, #{user.name}", email.body.to_s
513 513
   end
514 514
 end
515 515
 </ruby>

0 notes on commit ad1c447

Please sign in to comment.
Something went wrong with that request. Please try again.