Class: ActiveJob::QueueAdapters::TestAdapter
- Inherits:
-
Object
- Object
- ActiveJob::QueueAdapters::TestAdapter
- Defined in:
- lib/active_job/queue_adapters/test_adapter.rb
Overview
Test adapter for Active Job
The test adapter should be used only in testing. Along with ActiveJob::TestCase
and ActiveJob::TestHelper
it makes a great tool to test your Rails application.
To use the test adapter set queue_adapter config to :test
.
Rails.application.config.active_job.queue_adapter = :test
Instance Attribute Summary collapse
-
#enqueued_jobs ⇒ Object
Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#perform_enqueued_at_jobs ⇒ Object
Returns the value of attribute perform_enqueued_at_jobs.
-
#perform_enqueued_jobs ⇒ Object
Returns the value of attribute perform_enqueued_jobs.
-
#performed_jobs ⇒ Object
Provides a store of all the performed jobs with the TestAdapter so you can check them.
Instance Method Summary collapse
-
#enqueue(job) ⇒ Object
:nodoc:.
-
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:.
Instance Attribute Details
#enqueued_jobs ⇒ Object
Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
17 18 19 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 17 def enqueued_jobs @enqueued_jobs ||= [] end |
#filter ⇒ Object
Returns the value of attribute filter.
13 14 15 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 13 def filter @filter end |
#perform_enqueued_at_jobs ⇒ Object
Returns the value of attribute perform_enqueued_at_jobs.
13 14 15 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 13 def perform_enqueued_at_jobs @perform_enqueued_at_jobs end |
#perform_enqueued_jobs ⇒ Object
Returns the value of attribute perform_enqueued_jobs.
13 14 15 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 13 def perform_enqueued_jobs @perform_enqueued_jobs end |
#performed_jobs ⇒ Object
Provides a store of all the performed jobs with the TestAdapter so you can check them.
22 23 24 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 22 def performed_jobs @performed_jobs ||= [] end |
Instance Method Details
#enqueue(job) ⇒ Object
:nodoc:
26 27 28 29 30 31 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 26 def enqueue(job) #:nodoc: return if filtered?(job) job_data = job_to_hash(job) enqueue_or_perform(perform_enqueued_jobs, job, job_data) end |
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:
33 34 35 36 37 38 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 33 def enqueue_at(job, ) #:nodoc: return if filtered?(job) job_data = job_to_hash(job, at: ) enqueue_or_perform(perform_enqueued_at_jobs, job, job_data) end |