aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-09-05 07:08:39 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-09-05 07:08:39 -0700
commita23e3855c5a8a2b0747c856c195ab7adc17f601e (patch)
tree132a3b0f7bd7305ae8627f96b6fd175722c66030 /actionpack/test
parentf4a690dae7eec4ab8c129a0318fadc179e055d80 (diff)
parentffe56f3b8c579b5f5dbf47ae1e5bb052a64d9783 (diff)
downloadrails-a23e3855c5a8a2b0747c856c195ab7adc17f601e.tar.gz
rails-a23e3855c5a8a2b0747c856c195ab7adc17f601e.tar.bz2
rails-a23e3855c5a8a2b0747c856c195ab7adc17f601e.zip
Merge pull request #2872 from sikachu/content_tag_html_safe
Make sure that result from content_tag_for with collection is html_safe
Diffstat (limited to 'actionpack/test')
-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 7d38b01c1b..7f23629e05 100644
--- a/actionpack/test/template/record_tag_helper_test.rb
+++ b/actionpack/test/template/record_tag_helper_test.rb
@@ -83,4 +83,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