mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
a75f085941
git-subtree-dir: activejob git-subtree-mainline:b45b99894a
git-subtree-split:14f74a8331
22 lines
996 B
Ruby
22 lines
996 B
Ruby
require 'helper'
|
|
require 'jobs/callback_job'
|
|
|
|
require 'active_support/core_ext/object/inclusion'
|
|
|
|
class CallbacksTest < ActiveSupport::TestCase
|
|
test 'perform callbacks' do
|
|
performed_callback_job = CallbackJob.new.tap { |j| j.execute("A-JOB-ID") }
|
|
assert "CallbackJob ran before_perform".in? performed_callback_job.history
|
|
assert "CallbackJob ran after_perform".in? performed_callback_job.history
|
|
assert "CallbackJob ran around_perform_start".in? performed_callback_job.history
|
|
assert "CallbackJob ran around_perform_stop".in? performed_callback_job.history
|
|
end
|
|
|
|
test 'enqueue callbacks' do
|
|
enqueued_callback_job = CallbackJob.enqueue
|
|
assert "CallbackJob ran before_enqueue".in? enqueued_callback_job.history
|
|
assert "CallbackJob ran after_enqueue".in? enqueued_callback_job.history
|
|
assert "CallbackJob ran around_enqueue_start".in? enqueued_callback_job.history
|
|
assert "CallbackJob ran around_enqueue_stop".in? enqueued_callback_job.history
|
|
end
|
|
end
|