Sha256: 8acec6e91cc09b39485ccf14f26156cdd2415f9bf91f33240cde4ed815440792

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

module SphinxHelpers
  def sphinx
    @sphinx ||= SphinxController.new
  end

  def index(*indices)
    yield if block_given?

    ThinkingSphinx.before_index_hooks.each &:call
    sphinx.index *indices
    sleep 0.25

    ThinkingSphinx::Connection.pool.clear
  end

  def work
    resque_worker = Resque::Worker.new("ts_delta")
    resque_worker.register_worker

    while job = resque_worker.reserve
      resque_worker.perform(job)
    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

2 entries across 2 versions & 1 rubygems

Version Path
ts-resque-delta-2.1.0 spec/acceptance/support/sphinx_helpers.rb
ts-resque-delta-2.0.0 spec/acceptance/support/sphinx_helpers.rb