diff options
-rw-r--r-- | activejob/lib/active_job/test_helper.rb | 28 | ||||
-rw-r--r-- | activerecord/CHANGELOG.md | 2 | ||||
-rw-r--r-- | activesupport/CHANGELOG.md | 5 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 1 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 1 |
5 files changed, 22 insertions, 15 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb index 767619097c..fa0576669e 100644 --- a/activejob/lib/active_job/test_helper.rb +++ b/activejob/lib/active_job/test_helper.rb @@ -21,9 +21,9 @@ module ActiveJob # # def test_jobs # assert_enqueued_jobs 0 - # HelloJob.enqueue('david') + # HelloJob.perform_later('david') # assert_enqueued_jobs 1 - # HelloJob.enqueue('abdelkader') + # HelloJob.perform_later('abdelkader') # assert_enqueued_jobs 2 # end # @@ -32,12 +32,12 @@ module ActiveJob # # def test_jobs_again # assert_enqueued_jobs 1 do - # HelloJob.enqueue('cristian') + # HelloJob.perform_later('cristian') # end # # assert_enqueued_jobs 2 do - # HelloJob.enqueue('aaron') - # HelloJob.enqueue('rafael') + # HelloJob.perform_later('aaron') + # HelloJob.perform_later('rafael') # end # end def assert_enqueued_jobs(number) @@ -57,7 +57,7 @@ module ActiveJob # # def test_jobs # assert_no_enqueued_jobs - # HelloJob.enqueue('jeremy') + # HelloJob.perform_later('jeremy') # assert_enqueued_jobs 1 # end # @@ -80,9 +80,9 @@ module ActiveJob # # def test_jobs # assert_performed_jobs 0 - # HelloJob.enqueue('xavier') + # HelloJob.perform_later('xavier') # assert_performed_jobs 1 - # HelloJob.enqueue('yves') + # HelloJob.perform_later('yves') # assert_performed_jobs 2 # end # @@ -91,12 +91,12 @@ module ActiveJob # # def test_jobs_again # assert_performed_jobs 1 do - # HelloJob.enqueue('robin') + # HelloJob.perform_later('robin') # end # # assert_performed_jobs 2 do - # HelloJob.enqueue('carlos') - # HelloJob.enqueue('sean') + # HelloJob.perform_later('carlos') + # HelloJob.perform_later('sean') # end # end def assert_performed_jobs(number) @@ -116,7 +116,7 @@ module ActiveJob # # def test_jobs # assert_no_performed_jobs - # HelloJob.enqueue('matthew') + # HelloJob.perform_later('matthew') # assert_performed_jobs 1 # end # @@ -139,7 +139,7 @@ module ActiveJob # # def assert_enqueued_job # assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low') do - # MyJob.enqueue(1,2,3) + # MyJob.perform_later(1,2,3) # end # end def assert_enqueued_with(args = {}, &_block) @@ -159,7 +159,7 @@ module ActiveJob # # def test_assert_performed_with # assert_performed_with(job: MyJob, args: [1,2,3], queue: 'high') do - # MyJob.enqueue(1,2,3) + # MyJob.perform_later(1,2,3) # end # end def assert_performed_with(args = {}, &_block) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index be47ef75e7..a19e9654bf 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -49,7 +49,7 @@ Example: - # For not swallow errors in after_commit/after_rollback callbacks. + # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true Fixes #13460. diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 62e16ed9bd..cae5ac6e17 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,8 @@ +* Make Time#change throw an exception if the :usec option is out of range and + the time has an offset other than UTC or local. + + *Agis Anastasopoulos* + * `Method` objects now report themselves as not `duplicable?`. This allows hashes and arrays containing `Method` objects to be `deep_dup`ed. diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 89cd7516cd..6a7bf7445a 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -87,6 +87,7 @@ class Time elsif zone ::Time.local(new_year, new_month, new_day, new_hour, new_min, new_sec, new_usec) else + raise ArgumentError, 'argument out of range' if new_usec > 999999 ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec + (new_usec.to_r / 1000000), utc_offset) end end 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 |