aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-09-07 05:51:31 -0700
committerJon Leighton <j@jonathanleighton.com>2011-09-07 05:51:31 -0700
commit16f1ce41d5c3b5ab7c95d783f3d32dcc1fc6e485 (patch)
tree99059c2e2fbeb9c46879d965e131fe9b29cfffe7 /actionpack/test/controller
parentfb5dbe8c75e43284af80b7fceb4300980a0be0de (diff)
parent60d358b23348a14447d176fa51624ad5434eb575 (diff)
downloadrails-16f1ce41d5c3b5ab7c95d783f3d32dcc1fc6e485.tar.gz
rails-16f1ce41d5c3b5ab7c95d783f3d32dcc1fc6e485.tar.bz2
rails-16f1ce41d5c3b5ab7c95d783f3d32dcc1fc6e485.zip
Merge pull request #2499 from akaspick/assert_select_email_fix
Fix assert_select_email to work on non-multipart emails as well as converting the Mail::Body to a string to prevent errors.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/assert_select_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb
index 878484eb57..5eef8a32d7 100644
--- a/actionpack/test/controller/assert_select_test.rb
+++ b/actionpack/test/controller/assert_select_test.rb
@@ -20,6 +20,15 @@ class AssertSelectTest < ActionController::TestCase
end
end
+ class AssertMultipartSelectMailer < ActionMailer::Base
+ def test(options)
+ mail :subject => "Test e-mail", :from => "test@test.host", :to => "test <test@test.host>" do |format|
+ format.text { render :text => options[:text] }
+ format.html { render :text => options[:html] }
+ end
+ end
+ end
+
class AssertSelectController < ActionController::Base
def response_with=(content)
@content = content
@@ -313,6 +322,16 @@ EOF
end
end
+ def test_assert_select_email_multipart
+ AssertMultipartSelectMailer.test(:html => "<div><p>foo</p><p>bar</p></div>", :text => 'foo bar').deliver
+ assert_select_email do
+ assert_select "div:root" do
+ assert_select "p:first-child", "foo"
+ assert_select "p:last-child", "bar"
+ end
+ end
+ end
+
protected
def render_html(html)
@controller.response_with = html