123456789_123456789_123456789_123456789_123456789_

Class: ActiveJob::QueueAdapters::TestAdapter

Relationships & Source Files
Inherits: Object
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

Class Method Summary

Instance Attribute Summary

Constructor Details

.newTestAdapter

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 17

def initialize
  self.perform_enqueued_jobs = false
  self.perform_enqueued_at_jobs = false
end

Instance Attribute Details

#enqueued_jobs (rw)

Provides a store of all the enqueued jobs with the TestAdapter so you can check them.

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 23

def enqueued_jobs
  @enqueued_jobs ||= []
end

#enqueued_jobs=(value) (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15

attr_writer(:enqueued_jobs, :performed_jobs)

#name (readonly)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 13

delegate :name, to: :class

#perform_enqueued_at_jobs (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 14

attr_accessor(:perform_enqueued_jobs, :perform_enqueued_at_jobs)

#perform_enqueued_jobs (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 14

attr_accessor(:perform_enqueued_jobs, :perform_enqueued_at_jobs)

#performed_jobs (rw)

Provides a store of all the performed jobs with the TestAdapter so you can check them.

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 28

def performed_jobs
  @performed_jobs ||= []
end

#performed_jobs=(value) (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_adapters/test_adapter.rb', line 15

attr_writer(:enqueued_jobs, :performed_jobs)