1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/test/test_testing.rb

31 lines
698 B
Ruby
Raw Normal View History

require 'helper'
require 'sidekiq/worker'
class TestTesting < MiniTest::Unit::TestCase
describe 'sidekiq testing' do
class DirectWorker
include Sidekiq::Worker
def perform(a, b)
a + b
end
end
it 'calls the worker directly when in testing mode' do
begin
# Override Sidekiq::Worker
2012-02-10 01:33:36 -05:00
require 'sidekiq/testing'
assert_equal 3, DirectWorker.perform_async(1, 2)
ensure
# Undo override
2012-02-10 01:33:36 -05:00
Sidekiq::Worker::ClassMethods.class_eval do
remove_method :perform_async
alias_method :perform_async, :perform_async_old
remove_method :perform_async_old
end
end
end
end
end