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
Methods
Attributes
[RW] | at | |
[RW] | enqueue_after_transaction_commit | |
[W] | enqueued_jobs | |
[RW] | filter | |
[RW] | perform_enqueued_at_jobs | |
[RW] | perform_enqueued_jobs | |
[W] | performed_jobs | |
[RW] | queue | |
[RW] | reject |
Class Public methods
new(enqueue_after_transaction_commit: true)
📝 Source code
# File activejob/lib/active_job/queue_adapters/test_adapter.rb, line 18
def initialize(enqueue_after_transaction_commit: true)
@enqueue_after_transaction_commit = enqueue_after_transaction_commit
end
🔎 See on GitHub
Instance Public methods
enqueued_jobs()
Provides a store of all the enqueued jobs with the TestAdapter
so you can check them.
📝 Source code
# File activejob/lib/active_job/queue_adapters/test_adapter.rb, line 27
def enqueued_jobs
@enqueued_jobs ||= []
end
🔎 See on GitHub
performed_jobs()
Provides a store of all the performed jobs with the TestAdapter
so you can check them.
📝 Source code
# File activejob/lib/active_job/queue_adapters/test_adapter.rb, line 32
def performed_jobs
@performed_jobs ||= []
end
🔎 See on GitHub