Class: ActiveJob::QueueAdapters::TestAdapter
- Defined in:
- activejob/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
-
#at ⇒ Object
Returns the value of attribute at.
-
#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.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#reject ⇒ Object
Returns the value of attribute reject.
Instance Method Summary collapse
-
#enqueue(job) ⇒ Object
:nodoc:.
-
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:.
Instance Attribute Details
#at ⇒ Object
Returns the value of attribute at
15 16 17 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15 def at @at end |
#enqueued_jobs ⇒ Object
Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
19 20 21 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 19 def enqueued_jobs @enqueued_jobs ||= [] end |
#filter ⇒ Object
Returns the value of attribute filter
15 16 17 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15 def filter @filter end |
#perform_enqueued_at_jobs ⇒ Object
Returns the value of attribute perform_enqueued_at_jobs
15 16 17 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15 def perform_enqueued_at_jobs @perform_enqueued_at_jobs end |
#perform_enqueued_jobs ⇒ Object
Returns the value of attribute perform_enqueued_jobs
15 16 17 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15 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.
24 25 26 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 24 def performed_jobs @performed_jobs ||= [] end |
#queue ⇒ Object
Returns the value of attribute queue
15 16 17 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15 def queue @queue end |
#reject ⇒ Object
Returns the value of attribute reject
15 16 17 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15 def reject @reject end |
Instance Method Details
#enqueue(job) ⇒ Object
:nodoc:
28 29 30 31 32 33 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 28 def enqueue(job) #:nodoc: return if filtered?(job) job_data = job_to_hash(job) perform_or_enqueue(perform_enqueued_jobs, job, job_data) end |
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:
35 36 37 38 39 40 |
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 35 def enqueue_at(job, ) #:nodoc: return if filtered?(job) job_data = job_to_hash(job, at: ) perform_or_enqueue(perform_enqueued_at_jobs, job, job_data) end |