diff options
Diffstat (limited to 'activesupport/test/safe_buffer_test.rb')
-rw-r--r-- | activesupport/test/safe_buffer_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/safe_buffer_test.rb b/activesupport/test/safe_buffer_test.rb index a4e2acbb32..3a9854358c 100644 --- a/activesupport/test/safe_buffer_test.rb +++ b/activesupport/test/safe_buffer_test.rb @@ -60,4 +60,16 @@ class SafeBufferTest < ActiveSupport::TestCase yaml = YAML.dump data assert_equal({'str' => str}, YAML.load(yaml)) end + + test "Should not return safe buffer from gsub" do + altered_buffer = @buffer.gsub('', 'asdf') + assert_equal 'asdf', altered_buffer + assert !altered_buffer.html_safe? + end + + test "Should not allow gsub! on safe buffers" do + assert_raise TypeError do + @buffer.gsub!('', 'asdf') + end + end end |