aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/safe_buffer_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/safe_buffer_test.rb')
-rw-r--r--activesupport/test/safe_buffer_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/safe_buffer_test.rb b/activesupport/test/safe_buffer_test.rb
index b1a1c2d390..f475e05c9a 100644
--- a/activesupport/test/safe_buffer_test.rb
+++ b/activesupport/test/safe_buffer_test.rb
@@ -150,6 +150,14 @@ class SafeBufferTest < ActiveSupport::TestCase
assert_equal "hello&lt;&gt;", clean + @buffer
end
+ test "Should preserve html_safe? status on multiplication" do
+ multiplied_safe_buffer = "<br />".html_safe * 2
+ assert_predicate multiplied_safe_buffer, :html_safe?
+
+ multiplied_unsafe_buffer = @buffer.gsub("", "<>") * 2
+ assert_not_predicate multiplied_unsafe_buffer, :html_safe?
+ end
+
test "Should concat as a normal string when safe" do
clean = "hello".html_safe
@buffer.gsub!("", "<>")