diff options
Diffstat (limited to 'activesupport/test')
-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 |