diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-27 08:49:18 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-27 08:49:18 +0000 |
commit | cd1f2d7b0ed7a25ff1c298732f921ce6d6d86f73 (patch) | |
tree | 2a2d8b9e961e62d654e60dd93b86bf6d06eba199 /activesupport/test/core_ext | |
parent | 7faeb0db0731d7846d6cf75db633dd77d918e863 (diff) | |
download | rails-cd1f2d7b0ed7a25ff1c298732f921ce6d6d86f73.tar.gz rails-cd1f2d7b0ed7a25ff1c298732f921ce6d6d86f73.tar.bz2 rails-cd1f2d7b0ed7a25ff1c298732f921ce6d6d86f73.zip |
Date/Time/DateTime Ruby 1.9 compat
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7647 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/date_time_ext_test.rb | 1 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index 3c79fccdd1..b7bdbc5deb 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -32,6 +32,7 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase assert_equal DateTime.new(2005, 2, 21), DateTime.new(2005, 2, 21).to_datetime end + # FIXME: ruby 1.9 compat def test_to_time assert_equal Time.utc(2005, 2, 21, 10, 11, 12), DateTime.new(2005, 2, 21, 10, 11, 12, 0, 0).to_time assert_equal Time.local(2005, 2, 21, 10, 11, 12), DateTime.new(2005, 2, 21, 10, 11, 12, Rational(-5, 24), 0).to_time diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 88fd16531e..4a64ebd584 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -279,7 +279,8 @@ class TimeExtCalculationsTest < Test::Unit::TestCase def test_to_s time = Time.utc(2005, 2, 21, 17, 44, 30) - assert_equal "Mon Feb 21 17:44:30 UTC 2005", time.to_s + assert_equal time.to_default_s, time.to_s + assert_equal time.to_default_s, time.to_s(:doesnt_exist) assert_equal "2005-02-21 17:44:30", time.to_s(:db) assert_equal "21 Feb 17:44", time.to_s(:short) assert_equal "17:44", time.to_s(:time) @@ -381,10 +382,10 @@ class TimeExtCalculationsTest < Test::Unit::TestCase end protected - def with_timezone new_tz='US/Eastern' + def with_timezone(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz yield ensure - ENV['TZ'] = old_tz + old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') end end |