rails/activejob/test/cases
Jacopo 20545fc820 Allow testing discard_on/retry_on ActiveJob::DeserializationError
Previously in `perform_enqueued_jobs`, `deserialize_arguments_if_needed`
was called before calling `perform_now`. When a record no longer exists
and is serialized using GlobalID this led to raising
an `ActiveJob::DeserializationError` before reaching `perform_now` call.
This behaviour makes difficult testing the job `discard_on/retry_on` logic.

Now `deserialize_arguments_if_needed` call is postponed to when `perform_now`
is called.

Example:

```ruby
class UpdateUserJob < ActiveJob::Base
  discard_on ActiveJob::DeserializationError

  def perform(user)
    # ...
  end
end

User.destroy_all
assert_nothing_raised do
  perform_enqueued_jobs only: UpdateUserJob
end
assert_no_enqueued_jobs
```

Before this changes the test will fail, now it passes.
2021-08-23 21:16:56 +02:00
..
adapter_test.rb [Active Job] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
argument_serialization_test.rb Added more regression for activejob Range serializer. 2021-05-18 16:29:34 +05:30
callbacks_test.rb Return false when enqueuing a job is aborted 2020-10-30 00:25:31 +00:00
delayed_job_adapter_test.rb Avoid logging delayed job arguments if log_arguments set to false 2021-08-01 21:46:44 +01:00
exceptions_test.rb Tweak unreachable assertion tests in the block of assert_raises 2021-08-17 20:33:08 +09:00
job_serialization_test.rb Fix random CI fail due to auto-updating timestamp 2020-04-06 23:31:29 -05:00
logging_test.rb change the perform instrumentation to wrap perform_now instead of the perform method. 2020-12-31 11:13:03 +09:00
queue_adapter_test.rb Fix queue adapter class delegation to point to self.class 2019-09-23 21:59:59 -03:00
queue_naming_test.rb Stop queue_name_prefix from being global 2019-09-13 18:30:19 -03:00
queue_priority_test.rb [Active Job] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
queuing_test.rb Communicate enqueue failures to callers of perform_later 2021-02-05 16:32:43 -05:00
rescue_test.rb Allow jobs to rescue all exceptions 2021-01-23 08:35:51 -05:00
serializers_test.rb Enable Layout/EmptyLinesAroundAccessModifier cop 2019-06-13 12:00:45 +09:00
test_case_test.rb [Active Job] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
test_helper_test.rb Allow testing discard_on/retry_on ActiveJob::DeserializationError 2021-08-23 21:16:56 +02:00
timezones_test.rb Reset Time.zone to avoid leaking into other tests 2020-11-15 01:02:22 +00:00
translation_test.rb [Active Job] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00