aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/json/encoding_test.rb4
-rw-r--r--activesupport/test/whiny_nil_test.rb13
2 files changed, 10 insertions, 7 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index 5d81d09f03..cf9a635b5f 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -23,7 +23,9 @@ class TestJSONEncoding < Test::Unit::TestCase
StringTests = [[ 'this is the <string>', %("this is the \\u003Cstring\\u003E")],
[ 'a "string" with quotes & an ampersand', %("a \\"string\\" with quotes \\u0026 an ampersand") ],
- [ 'http://test.host/posts/1', %("http://test.host/posts/1")]]
+ [ 'http://test.host/posts/1', %("http://test.host/posts/1")],
+ [ "Control characters: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
+ %("Control characters: \\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000B\\f\\r\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F") ]]
ArrayTests = [[ ['a', 'b', 'c'], %([\"a\",\"b\",\"c\"]) ],
[ [1, 'a', :b, nil, false], %([1,\"a\",\"b\",null,false]) ]]
diff --git a/activesupport/test/whiny_nil_test.rb b/activesupport/test/whiny_nil_test.rb
index 009d97940f..1e4f8d854a 100644
--- a/activesupport/test/whiny_nil_test.rb
+++ b/activesupport/test/whiny_nil_test.rb
@@ -13,38 +13,39 @@ class WhinyNilTest < Test::Unit::TestCase
def test_unchanged
nil.method_thats_not_in_whiners
rescue NoMethodError => nme
- assert(nme.message =~ /nil:NilClass/)
+ assert_match(/nil:NilClass/, nme.message)
end
def test_active_record
nil.save!
rescue NoMethodError => nme
- assert(!(nme.message =~ /nil:NilClass/))
+ assert_no_match(/nil:NilClass/, nme.message)
assert_match(/nil\.save!/, nme.message)
end
def test_array
nil.each
rescue NoMethodError => nme
- assert(!(nme.message =~ /nil:NilClass/))
+ assert_no_match(/nil:NilClass/, nme.message)
assert_match(/nil\.each/, nme.message)
end
def test_id
nil.id
rescue RuntimeError => nme
- assert(!(nme.message =~ /nil:NilClass/))
+ assert_no_match(/nil:NilClass/, nme.message)
end
def test_no_to_ary_coercion
nil.to_ary
rescue NoMethodError => nme
- assert(nme.message =~ /nil:NilClass/)
+ assert_no_match(/nil:NilClass/, nme.message)
+ assert_match(/nil\.to_ary/, nme.message)
end
def test_no_to_str_coercion
nil.to_str
rescue NoMethodError => nme
- assert(nme.message =~ /nil:NilClass/)
+ assert_match(/nil:NilClass/, nme.message)
end
end