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
Mike Perham f9af66edd7 Rework redis connections so that the manager and
the client use separate pools.

This is so the Rails app Sidekiq::Client and 
Sidekiq::Manager can use different configurations.

Also, fix issue where workers were not unregistered
in Redis upon shutdown.
2012-02-11 13:14:03 -08:00

32 lines
778 B
Ruby

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 'stubs the async call when in testing mode' do
begin
# Override Sidekiq::Worker
require 'sidekiq/testing'
assert_equal 0, DirectWorker.jobs.size
assert DirectWorker.perform_async(1, 2)
assert_equal 1, DirectWorker.jobs.size
ensure
# Undo override
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