aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-20 18:22:21 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-20 18:22:21 +0100
commit7ab47751068c6480e7e44fc9265a7e690dd4af3b (patch)
tree256b236f0d37625f9d74af4d4280a4673fb4f805 /activesupport/test/core_ext/string_ext_test.rb
parent51095be1b08b1dd2a8a049f009bac6220fa7a68b (diff)
downloadrails-7ab47751068c6480e7e44fc9265a7e690dd4af3b.tar.gz
rails-7ab47751068c6480e7e44fc9265a7e690dd4af3b.tar.bz2
rails-7ab47751068c6480e7e44fc9265a7e690dd4af3b.zip
Initial pass at removing dead 1.8.x code from Active Support.
There are a bunch of other implicit branches that adds 1.8.x specific code that still needs to be removed. Pull requests for those cases are welcome.
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb50
1 files changed, 6 insertions, 44 deletions
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