aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2013-09-22 12:33:12 -0700
committerAndrew White <andyw@pixeltrix.co.uk>2013-09-22 12:33:12 -0700
commitffc8abd41b420c2eac58fe92fb03e494e690e43f (patch)
treed11382412cc23219eead5e3ed5c3d1d07bcf5970 /activesupport/test
parent2356aed7701603feb5564ec3ddb9d57760eaa8a4 (diff)
parentf9e60c74b665954407f7de3265ae6996fc5e4635 (diff)
downloadrails-ffc8abd41b420c2eac58fe92fb03e494e690e43f.tar.gz
rails-ffc8abd41b420c2eac58fe92fb03e494e690e43f.tar.bz2
rails-ffc8abd41b420c2eac58fe92fb03e494e690e43f.zip
Merge pull request #11474 from bogdan/time-with-zone-succ
Prevent server blow up when iterating over TimeWithZone Range
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/range_ext_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb
index 2f8723a074..854b0a38bd 100644
--- a/activesupport/test/core_ext/range_ext_test.rb
+++ b/activesupport/test/core_ext/range_ext_test.rb
@@ -90,4 +90,26 @@ class RangeTest < ActiveSupport::TestCase
time_range_2 = Time.utc(2005, 12, 10, 17, 31)..Time.utc(2005, 12, 10, 18, 00)
assert !time_range_1.overlaps?(time_range_2)
end
+
+ def test_each_on_time_with_zone
+ twz = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone['Eastern Time (US & Canada)'] , Time.utc(2006,11,28,10,30))
+ assert_raises TypeError do
+ ((twz - 1.hour)..twz).each {}
+ end
+ end
+
+ def test_step_on_time_with_zone
+ twz = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone['Eastern Time (US & Canada)'] , Time.utc(2006,11,28,10,30))
+ assert_raises TypeError do
+ ((twz - 1.hour)..twz).step(1) {}
+ end
+ end
+
+ def test_include_on_time_with_zone
+ twz = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone['Eastern Time (US & Canada)'] , Time.utc(2006,11,28,10,30))
+ assert_raises TypeError do
+ ((twz - 1.hour)..twz).include?(twz)
+ end
+ end
+
end