diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-11-04 13:20:22 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-11-04 13:20:22 +0000 |
commit | 9887a2cfe52f30d4a91e0d16fe57ecf96537b98c (patch) | |
tree | eab3c5a32eebd6e913b3960ac8b9c7f927264c56 /activesupport/test | |
parent | 70177618afd704884e669454173456e41411f136 (diff) | |
parent | b670fadb978c8a12c3414ed842cd49e4fde2cec0 (diff) | |
download | rails-9887a2cfe52f30d4a91e0d16fe57ecf96537b98c.tar.gz rails-9887a2cfe52f30d4a91e0d16fe57ecf96537b98c.tar.bz2 rails-9887a2cfe52f30d4a91e0d16fe57ecf96537b98c.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 14 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 5 | ||||
-rw-r--r-- | activesupport/test/json/encoding_test.rb | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 2f4691817f..35095f2b2d 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -260,8 +260,18 @@ class StringInflectionsTest < ActiveSupport::TestCase end def test_remove - assert_equal "Summer", "Fast Summer".remove(/Fast /) - assert_equal "Summer", "Fast Summer".remove!(/Fast /) + original = "This is a good day to die" + assert_equal "This is a good day", original.remove(" to die") + assert_equal "This is a good day", original.remove(" to ", /die/) + assert_equal "This is a good day to die", original + end + + def test_remove! + original = "This is a very good day to die" + assert_equal "This is a good day to die", original.remove!(" very") + assert_equal "This is a good day to die", original + assert_equal "This is a good day", original.remove!(" to ", /die/) + assert_equal "This is a good day", original end def test_constantize diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 3000da8da4..ad4062e5fe 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -79,6 +79,11 @@ class TimeWithZoneTest < ActiveSupport::TestCase assert_equal '1999-12-31 19:00:00 EST -0500', @twz.strftime('%Y-%m-%d %H:%M:%S %Z %z') end + def test_strftime_with_escaping + assert_equal '%Z %z', @twz.strftime('%%Z %%z') + assert_equal '%EST %-0500', @twz.strftime('%%%Z %%%z') + end + def test_inspect assert_equal 'Fri, 31 Dec 1999 19:00:00 EST -05:00', @twz.inspect end diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index ad358ad21d..7e976aa772 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -68,7 +68,7 @@ class TestJSONEncoding < ActiveSupport::TestCase [ 1.0/0.0, %(null) ], [ -1.0/0.0, %(null) ], [ BigDecimal('0.0')/BigDecimal('0.0'), %(null) ], - [ BigDecimal('2.5'), %("#{BigDecimal('2.5').to_s}") ]] + [ BigDecimal('2.5'), %("#{BigDecimal('2.5')}") ]] StringTests = [[ 'this is the <string>', %("this is the \\u003cstring\\u003e")], [ 'a "string" with quotes & an ampersand', %("a \\"string\\" with quotes \\u0026 an ampersand") ], |