diff options
author | r7kamura <r7kamura@gmail.com> | 2019-04-18 17:44:22 +0900 |
---|---|---|
committer | r7kamura <r7kamura@gmail.com> | 2019-04-19 06:32:55 +0900 |
commit | 9dd254c2a20b393d68c9db4b17a15a672e2a2c16 (patch) | |
tree | ce7a58117e7bd4936ea2c1993eb9b1f085796ac9 /activesupport/test | |
parent | 98a75b46468c45d4477949ed267bb8823297d815 (diff) | |
download | rails-9dd254c2a20b393d68c9db4b17a15a672e2a2c16.tar.gz rails-9dd254c2a20b393d68c9db4b17a15a672e2a2c16.tar.bz2 rails-9dd254c2a20b393d68c9db4b17a15a672e2a2c16.zip |
Preserve html_safe? status on ActiveSupport::SafeBuffer#*
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/safe_buffer_test.rb | 8 |
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<>", 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!("", "<>") |