Register autoload for ActiveJob::Arguments

Since #50715, there are cases where `ActiveJob::Arguments` is used
but not required anymore in the test environment. This could be a
test for a custom argument serializer.

One solution could be to add a require "active_job/arguments" in
all the usages, but that isn't a convention we follow in Rails.

Instead, let's register the autoload for `ActiveJob::Arguments` in
`active_job.rb` so that it's always available when needed.
This commit is contained in:
Rafael Mendonça França 2024-02-13 20:32:07 +00:00
parent 8e20f5d3b2
commit 154f7c2181
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
5 changed files with 3 additions and 6 deletions

@ -1,7 +1,5 @@
# frozen_string_literal: true
require "active_job/arguments"
class DelayedMailerError < StandardError; end
class DelayedMailer < ActionMailer::Base

@ -36,6 +36,9 @@ module ActiveJob
autoload :Base
autoload :QueueAdapters
autoload :Arguments
autoload :DeserializationError, "active_job/arguments"
autoload :SerializationError, "active_job/arguments"
eager_autoload do
autoload :Serializers

@ -1,7 +1,5 @@
# frozen_string_literal: true
require "active_job/arguments"
module ActiveJob
# Provides behavior for enqueuing jobs.

@ -1,7 +1,6 @@
# frozen_string_literal: true
require "active_support/rescuable"
require "active_job/arguments"
module ActiveJob
# = Active Job \Execution

@ -3,7 +3,6 @@
require "json"
require "bigdecimal"
require "helper"
require "active_job/arguments"
require "models/person"
require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/integer/time"