aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-01-03 17:59:07 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-01-03 17:59:07 -0800
commite3ce5ea303ef431d0db97c3c3ea2204c22cd6e48 (patch)
tree3476dcbf018c506499a04ac3523c369dbbb44c96 /activesupport/test/core_ext/time_with_zone_test.rb
parent4d240ec20a70122b7e69c790a37d2be14e1ff038 (diff)
parent38f28dca3aa16efd6cc3af6453f2e6b9e9655ec1 (diff)
downloadrails-e3ce5ea303ef431d0db97c3c3ea2204c22cd6e48.tar.gz
rails-e3ce5ea303ef431d0db97c3c3ea2204c22cd6e48.tar.bz2
rails-e3ce5ea303ef431d0db97c3c3ea2204c22cd6e48.zip
Merge pull request #7350 from slbug/date_time_ranges_with_infinite_bounds
Added ability to compare date/time with infinity
Diffstat (limited to 'activesupport/test/core_ext/time_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb12
1 files changed, 12 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 56020da035..76dc6a35c8 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -1081,3 +1081,15 @@ class TimeWithZoneMethodsForString < ActiveSupport::TestCase
Time.zone = old_tz
end
end
+
+class TimeWithZoneExtBehaviorTest < ActiveSupport::TestCase
+ def test_compare_with_infinity
+ time_zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
+ twz = ActiveSupport::TimeWithZone.new(Time.now, time_zone)
+
+ assert_nothing_raised do
+ assert_equal(-1, twz <=> Float::INFINITY)
+ assert_equal(1, twz <=> -Float::INFINITY)
+ end
+ end
+end