diff options
Diffstat (limited to 'activesupport/test/safe_buffer_test.rb')
-rw-r--r-- | activesupport/test/safe_buffer_test.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/activesupport/test/safe_buffer_test.rb b/activesupport/test/safe_buffer_test.rb index 8f77999d25..bdde5141a9 100644 --- a/activesupport/test/safe_buffer_test.rb +++ b/activesupport/test/safe_buffer_test.rb @@ -1,9 +1,4 @@ require 'abstract_unit' -begin - require 'psych' -rescue LoadError -end - require 'active_support/core_ext/string/inflections' require 'yaml' @@ -12,6 +7,10 @@ class SafeBufferTest < ActiveSupport::TestCase @buffer = ActiveSupport::SafeBuffer.new end + def test_titleize + assert_equal 'Foo', "foo".html_safe.titleize + end + test "Should look like a string" do assert @buffer.is_a?(String) assert_equal "", @buffer @@ -96,13 +95,20 @@ class SafeBufferTest < ActiveSupport::TestCase assert !@buffer.dup.html_safe? end + test "Should return safe buffer when added with another safe buffer" do + clean = "<script>".html_safe + result_buffer = @buffer + clean + assert result_buffer.html_safe? + assert_equal "<script>", result_buffer + end + test "Should raise an error when safe_concat is called on dirty buffers" do @buffer.gsub!('', '<>') assert_raise ActiveSupport::SafeBuffer::SafeConcatError do @buffer.safe_concat "BUSTED" end end - + test "should not fail if the returned object is not a string" do assert_kind_of NilClass, @buffer.slice("chipchop") end |