1
0
Fork 0
mirror of https://github.com/deanpcmad/sidekiq-limit_fetch.git synced 2022-11-09 13:54:36 -05:00
deanpcmad--sidekiq-limit_fetch/spec/spec_helper.rb
2013-01-25 11:26:45 +04:00

20 lines
592 B
Ruby

require 'sidekiq/limit_fetch'
RSpec.configure do |config|
config.before :each do
Sidekiq::Queue.instance_variable_set :@instances, {}
Sidekiq.options[:global] = defined?(global) ? global : nil
Sidekiq.redis do |it|
clean_redis = ->(queue) do
it.del "limit_fetch:limit:#{queue}"
it.del "limit_fetch:busy:#{queue}"
it.del "limit_fetch:pause:#{queue}"
it.del "limit_fetch:block:#{queue}"
end
clean_redis.call(name) if defined?(name)
queues.each(&clean_redis) if defined?(queues) and queues.is_a? Array
end
end
end