Class: ActiveJob::QueueAdapters::TestAdapter
- Inherits:
-
Object
- Object
- ActiveJob::QueueAdapters::TestAdapter
- Defined in:
- lib/active_job/queue_adapters/test_adapter.rb
Instance Attribute Summary collapse
-
#enqueued_jobs ⇒ Object
Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
-
#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
Instance Attribute Details
#enqueued_jobs ⇒ Object
Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
8 9 10 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 8 def enqueued_jobs @enqueued_jobs ||= [] end |
#perform_enqueued_at_jobs ⇒ Object
Returns the value of attribute perform_enqueued_at_jobs.
4 5 6 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 4 def perform_enqueued_at_jobs @perform_enqueued_at_jobs end |
#perform_enqueued_jobs ⇒ Object
Returns the value of attribute perform_enqueued_jobs.
4 5 6 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 4 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.
17 18 19 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 17 def performed_jobs @performed_jobs ||= [] end |
Instance Method Details
#enqueue(job) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 21 def enqueue(job) if perform_enqueued_jobs performed_jobs << {job: job.class, args: job.arguments, queue: job.queue_name} job.perform_now else enqueued_jobs << {job: job.class, args: job.arguments, queue: job.queue_name} end end |
#enqueue_at(job, timestamp) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 30 def enqueue_at(job, ) if perform_enqueued_at_jobs performed_jobs << {job: job.class, args: job.arguments, queue: job.queue_name, at: } job.perform_now else enqueued_jobs << {job: job.class, args: job.arguments, queue: job.queue_name, at: } end end |
#name ⇒ Object
12 13 14 |
# File 'lib/active_job/queue_adapters/test_adapter.rb', line 12 def name self.class.name end |