mirror of https://github.com/rails/rails
Fix incorrect arguments for Active Job test job
This is an internal fix, not user facing.
Currently the `LoggingJob` does not accept more than one argument. But there's [a few tests](f46d3452ae/activejob/test/cases/test_helper_test.rb (L518-L537)
) that call it with multiple arguments and assert that it is queued correctly. Those tests pass because the job is not performed, but if the job was performed, they'd fail.
This PR just fixes `LoggingJob` to accept a splat of arguments, and adds a test to ensure that it works correctly.
This commit is contained in:
parent
f46d3452ae
commit
2385b6e4e5
|
@ -515,6 +515,12 @@ class EnqueuedJobsTest < ActiveJob::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_assert_no_enqueued_jobs_and_perform_now
|
||||||
|
assert_no_enqueued_jobs do
|
||||||
|
LoggingJob.perform_now(1, 2, 3, keyword: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_assert_enqueued_with_returns
|
def test_assert_enqueued_with_returns
|
||||||
job = assert_enqueued_with(job: LoggingJob) do
|
job = assert_enqueued_with(job: LoggingJob) do
|
||||||
LoggingJob.set(wait_until: 5.minutes.from_now).perform_later(1, 2, 3, keyword: true)
|
LoggingJob.set(wait_until: 5.minutes.from_now).perform_later(1, 2, 3, keyword: true)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class LoggingJob < ActiveJob::Base
|
class LoggingJob < ActiveJob::Base
|
||||||
def perform(dummy)
|
def perform(*dummy)
|
||||||
logger.info "Dummy, here is it: #{dummy}"
|
logger.info "Dummy, here is it: #{dummy.join(" ")}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def job_id
|
def job_id
|
||||||
|
|
Loading…
Reference in New Issue