aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/capture_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/capture_helper_test.rb')
-rw-r--r--actionpack/test/template/capture_helper_test.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb
index f7c42c7f22..03050485fa 100644
--- a/actionpack/test/template/capture_helper_test.rb
+++ b/actionpack/test/template/capture_helper_test.rb
@@ -15,7 +15,6 @@ class CaptureHelperTest < ActionView::TestCase
end
assert_nil @av.output_buffer
assert_equal 'foobar', string
- assert_kind_of ActionView::NonConcattingString, string
end
def test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank
@@ -23,13 +22,22 @@ class CaptureHelperTest < ActionView::TestCase
a + b
end
assert_equal 'foobar', string
- assert_kind_of ActionView::NonConcattingString, string
end
def test_capture_returns_nil_if_the_returned_value_is_not_a_string
assert_nil @av.capture { 1 }
end
+ def test_capture_escapes_html
+ string = @av.capture { '<em>bar</em>' }
+ assert_equal '&lt;em&gt;bar&lt;/em&gt;', string
+ end
+
+ def test_capture_doesnt_escape_twice
+ string = @av.capture { '&lt;em&gt;bar&lt;/em&gt;'.html_safe }
+ assert_equal '&lt;em&gt;bar&lt;/em&gt;', string
+ end
+
def test_content_for
assert ! content_for?(:title)
content_for :title, 'title'