Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions spec/rspec/rails/matchers/active_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Loading