1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert #27850 following test breakage (#28427)

This commit is contained in:
David Heinemeier Hansson 2017-03-15 17:46:28 +01:00 committed by GitHub
parent e7a90bd8d1
commit 85c2b7565f
3 changed files with 7 additions and 19 deletions

View file

@ -6,10 +6,6 @@
*Yuji Yaginuma*
* Push skipped jobs to `enqueued_jobs` when using `perform_enqueued_jobs` with a `only` filter in tests
*Alexander Pauly*
* Removed deprecated support to passing the adapter class to `.queue_adapter`.
*Rafael Mendonça França*

View file

@ -24,27 +24,30 @@ module ActiveJob
end
def enqueue(job) #:nodoc:
return if filtered?(job)
job_data = job_to_hash(job)
enqueue_or_perform(perform_enqueued_jobs, job, job_data)
end
def enqueue_at(job, timestamp) #:nodoc:
return if filtered?(job)
job_data = job_to_hash(job, at: timestamp)
enqueue_or_perform(perform_enqueued_at_jobs, job, job_data)
end
private
def job_to_hash(job, extras = {})
{ job: job.class, args: job.serialize.fetch("arguments"), queue: job.queue_name }.merge!(extras)
end
def enqueue_or_perform(perform, job, job_data)
if !perform || filtered?(job)
enqueued_jobs << job_data
else
if perform
performed_jobs << job_data
Base.execute job.serialize
else
enqueued_jobs << job_data
end
end

View file

@ -56,17 +56,6 @@ class EnqueuedJobsTest < ActiveJob::TestCase
end
end
def test_assert_enqueued_jobs_when_performing_with_only_option
assert_nothing_raised do
assert_enqueued_jobs 1, only: HelloJob do
perform_enqueued_jobs only: LoggingJob do
HelloJob.perform_later("sean")
LoggingJob.perform_later("yves")
end
end
end
end
def test_assert_no_enqueued_jobs_with_no_block
assert_nothing_raised do
assert_no_enqueued_jobs