aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2011-09-05 20:04:37 +0700
committerPrem Sichanugrist <s@sikachu.com>2011-09-05 20:04:37 +0700
commitffe56f3b8c579b5f5dbf47ae1e5bb052a64d9783 (patch)
treee247c520e80f9ab8ce80d7ae213c857be9efe52a /actionpack/test/template
parent499ad11700dbfdfe6382f72fb8f46cad62ac7c9b (diff)
downloadrails-ffe56f3b8c579b5f5dbf47ae1e5bb052a64d9783.tar.gz
rails-ffe56f3b8c579b5f5dbf47ae1e5bb052a64d9783.tar.bz2
rails-ffe56f3b8c579b5f5dbf47ae1e5bb052a64d9783.zip
Make sure that result from content_tag_for with collection is html_safe
Thank you @spastorino for catching the empty test in b84cee0, as I totally forgot that I still have to make it html_safe.
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/record_tag_helper_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/template/record_tag_helper_test.rb b/actionpack/test/template/record_tag_helper_test.rb
index 81a1642ed8..a892d7a326 100644
--- a/actionpack/test/template/record_tag_helper_test.rb
+++ b/actionpack/test/template/record_tag_helper_test.rb
@@ -80,4 +80,16 @@ class RecordTagHelperTest < ActionView::TestCase
actual = div_for([post_1, post_2]) { |post| concat post.body }
assert_dom_equal expected, actual
end
+
+ def test_content_tag_for_single_record_is_html_safe
+ result = div_for(@post, :class => "bar") { concat @post.body }
+ assert result.html_safe?
+ end
+
+ def test_content_tag_for_collection_is_html_safe
+ post_1 = Post.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
+ post_2 = Post.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
+ result = content_tag_for(:li, [post_1, post_2]) { |post| concat post.body }
+ assert result.html_safe?
+ end
end