diff options
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/date_ext_test.rb | 10 | ||||
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 6 | ||||
-rw-r--r-- | activesupport/test/core_ext/range_ext_test.rb | 13 | ||||
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 50 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 3 |
5 files changed, 11 insertions, 71 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index c040d86327..09d4765390 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -384,16 +384,6 @@ class DateExtCalculationsTest < ActiveSupport::TestCase end end - if RUBY_VERSION < '1.9' - def test_rfc3339 - assert_equal('1980-02-28', Date.new(1980, 2, 28).rfc3339) - end - - def test_iso8601 - assert_equal('1980-02-28', Date.new(1980, 2, 28).iso8601) - end - end - def test_today Date.stubs(:current).returns(Date.new(2000, 1, 1)) assert_equal false, Date.new(1999, 12, 31).today? diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index eb8ed761da..dfa0cdb478 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -27,11 +27,7 @@ class HashExtTest < Test::Unit::TestCase @symbols = { :a => 1, :b => 2 } @mixed = { :a => 1, 'b' => 2 } @fixnums = { 0 => 1, 1 => 2 } - if RUBY_VERSION < '1.9.0' - @illegal_symbols = { "\0" => 1, "" => 2, [] => 3 } - else - @illegal_symbols = { [] => 3 } - end + @illegal_symbols = { [] => 3 } end def test_methods diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index 1424fa4aca..f4b773e5fb 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -63,15 +63,8 @@ class RangeTest < Test::Unit::TestCase assert_equal [1,3,5,7,9], array end - if RUBY_VERSION < '1.9' - def test_cover - assert((1..3).cover?(2)) - assert !(1..3).cover?(4) - end - else - def test_cover_is_not_override - range = (1..3) - assert range.method(:include?) != range.method(:cover?) - end + def test_cover_is_not_override + range = (1..3) + assert range.method(:include?) != range.method(:cover?) end end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 47b9f68ed0..aeae2579b4 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -160,14 +160,6 @@ class StringInflectionsTest < Test::Unit::TestCase assert_equal 97, 'abc'.ord end - if RUBY_VERSION < '1.9' - def test_getbyte - assert_equal 97, 'a'.getbyte(0) - assert_equal 99, 'abc'.getbyte(2) - assert_nil 'abc'.getbyte(3) - end - end - def test_string_to_time assert_equal Time.utc(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local) @@ -287,21 +279,9 @@ class StringInflectionsTest < Test::Unit::TestCase assert_equal "Hello Big[...]", "Hello Big World!".truncate(15, :omission => "[...]", :separator => ' ') end - if RUBY_VERSION < '1.9.0' - def test_truncate_multibyte - with_kcode 'none' do - assert_equal "\354\225\210\353\205\225\355...", "\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224".truncate(10) - end - with_kcode 'u' do - assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...", - "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".truncate(10) - end - end - else - def test_truncate_multibyte - assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".force_encoding('UTF-8'), - "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding('UTF-8').truncate(10) - end + def test_truncate_multibyte + assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".force_encoding('UTF-8'), + "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding('UTF-8').truncate(10) end def test_constantize @@ -338,22 +318,8 @@ class CoreExtStringMultibyteTest < ActiveSupport::TestCase assert !BYTE_STRING.is_utf8? end - if RUBY_VERSION < '1.9' - def test_mb_chars_returns_self_when_kcode_not_set - with_kcode('none') do - assert_kind_of String, UNICODE_STRING.mb_chars - end - end - - def test_mb_chars_returns_an_instance_of_the_chars_proxy_when_kcode_utf8 - with_kcode('UTF8') do - assert_kind_of ActiveSupport::Multibyte.proxy_class, UNICODE_STRING.mb_chars - end - end - else - def test_mb_chars_returns_instance_of_proxy_class - assert_kind_of ActiveSupport::Multibyte.proxy_class, UNICODE_STRING.mb_chars - end + def test_mb_chars_returns_instance_of_proxy_class + assert_kind_of ActiveSupport::Multibyte.proxy_class, UNICODE_STRING.mb_chars end end @@ -479,11 +445,7 @@ class OutputSafetyTest < ActiveSupport::TestCase end test 'knows whether it is encoding aware' do - if RUBY_VERSION >= "1.9" - assert 'ruby'.encoding_aware? - else - assert !'ruby'.encoding_aware? - end + assert 'ruby'.encoding_aware? end test "call to_param returns a normal string" do diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 9d9e411c28..04f5ea85a8 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -448,9 +448,8 @@ class TimeWithZoneTest < Test::Unit::TestCase end def test_ruby_19_weekday_name_query_methods - ruby_19_or_greater = RUBY_VERSION >= '1.9' %w(sunday? monday? tuesday? wednesday? thursday? friday? saturday?).each do |name| - assert_equal ruby_19_or_greater, @twz.respond_to?(name) + assert_respond_to @twz, name end end |