diff options
author | stopdropandrew <andrew@kongregate.com> | 2013-02-24 13:07:20 -0800 |
---|---|---|
committer | stopdropandrew <andrew@kongregate.com> | 2013-02-24 13:24:50 -0800 |
commit | cb100ca02bf0652e39a61e7687a6ac034b1a9c43 (patch) | |
tree | f06d115b43d7cd28e6e8c3c35d1dc298a71fc9c9 /activesupport/test/core_ext/time_with_zone_test.rb | |
parent | 1509844cdd53e137f8ae02d2df52d811357426ec (diff) | |
download | rails-cb100ca02bf0652e39a61e7687a6ac034b1a9c43.tar.gz rails-cb100ca02bf0652e39a61e7687a6ac034b1a9c43.tar.bz2 rails-cb100ca02bf0652e39a61e7687a6ac034b1a9c43.zip |
Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility.
Diffstat (limited to 'activesupport/test/core_ext/time_with_zone_test.rb')
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 21fef88d79..0f5699fd63 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -326,6 +326,17 @@ class TimeWithZoneTest < ActiveSupport::TestCase assert_equal 946684800, twz.to_i end + def test_to_r + result = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1), ActiveSupport::TimeZone['Hawaii']).to_r + assert_equal Rational(946684800, 1), result + assert_kind_of Rational, result + end + + def test_time_at + time = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1), ActiveSupport::TimeZone['Hawaii']) + assert_equal time, Time.at(time) + end + def test_to_time with_env_tz 'US/Eastern' do assert_equal Time, @twz.to_time.class |