From 57b2c371f03982813f6dc2e7f07467b4fca3a6ce Mon Sep 17 00:00:00 2001 From: Agis- Date: Mon, 1 Sep 2014 15:54:29 +0300 Subject: Time#change throws exception with an out-of-range :usec https://github.com/rails/rails/commit/98b46bf5e201307cae56ee14bf41363a539779c5 did not properly handled out-of-range `:usec`s. Passing a `:usec` that's out of range now throws an `ArgumentError` as it should. Fixes #16759. --- activesupport/test/core_ext/time_ext_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index c8283cddc5..9a5bd19be2 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -405,6 +405,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase assert_equal Time.new(2005,2,22,16,0,0,"-08:00"), Time.new(2005,2,22,15,15,10,"-08:00").change(:hour => 16) assert_equal Time.new(2005,2,22,16,45,0,"-08:00"), Time.new(2005,2,22,15,15,10,"-08:00").change(:hour => 16, :min => 45) assert_equal Time.new(2005,2,22,15,45,0,"-08:00"), Time.new(2005,2,22,15,15,10,"-08:00").change(:min => 45) + assert_raise(ArgumentError) { Time.new(2005, 2, 22, 15, 15, 45, "-08:00").change(:usec => 1000000) } end def test_advance -- cgit v1.2.3