Sha256: 70b905e5f2c78fba9f419d59aa32c2c20bff196a24f0bd2a401725405318e432
Contents?: true
Size: 915 Bytes
Versions: 3
Compression:
Stored size: 915 Bytes
Contents
module SphinxHelpers include Sidekiq::Util def sphinx @sphinx ||= SphinxController.new end def index(*indices) yield if block_given? ThinkingSphinx::Deltas::SidekiqDelta.clear_thinking_sphinx_queues sphinx.index *indices sleep 0.25 end def work client = Redis.connect(:url => "resque://localhost:6379/") namespace = Redis::Namespace.new('test', :redis => client) Sidekiq::Client.registered_queues.each do |queue_name| while message = namespace.lpop("queue:#{queue_name}") message = JSON.parse(message) message['class'].constantize.new.perform(*message['args']) end end end end RSpec.configure do |config| config.include SphinxHelpers config.before :all do |group| sphinx.setup && sphinx.start if group.class.metadata[:live] end config.after :all do |group| sphinx.stop if group.class.metadata[:live] end end
Version data entries
3 entries across 3 versions & 1 rubygems