diff --git a/spec/rspec/rails/matchers/active_job_spec.rb b/spec/rspec/rails/matchers/active_job_spec.rb index 86e191ae5..1a52e52ae 100644 --- a/spec/rspec/rails/matchers/active_job_spec.rb +++ b/spec/rspec/rails/matchers/active_job_spec.rb @@ -78,6 +78,17 @@ def self.name; "KeywordArgsJob"; end end end + let(:callback_job) do + Class.new(ActiveJob::Base) do + before_enqueue do |job| + job.arguments << 3 + end + + def perform(one, two); end + def self.name; "CallbackJob"; end + end + end + before do ActiveJob::Base.queue_adapter = :test end @@ -372,6 +383,12 @@ def perform; raise StandardError; end }.to have_enqueued_job.with(42, "David") end + it "will match arguments added in callbacks" do + expect { + callback_job.perform_later(1, 2) + }.to have_enqueued_job.with(1, 2, 3) + end + it "fails if the arguments do not match the job's signature" do expect { expect {