Sha256: 84df54110b4c1804188c0d81550852126d6dc76aaebd25218c0fb2b9893b1e17

Contents?: true

Size: 711 Bytes

Versions: 4

Compression:

Stored size: 711 Bytes

Contents

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

  def index(*indices)
    sleep 0.5 if ENV['TRAVIS']

    yield if block_given?

    sphinx.index *indices
    sleep 0.25
    sleep 0.5 if ENV['TRAVIS']
  end
end

RSpec.configure do |config|
  config.include SphinxHelpers

  config.before :all do |group|
    FileUtils.rm_rf ThinkingSphinx::Configuration.instance.indices_location
    FileUtils.rm_rf ThinkingSphinx::Configuration.instance.searchd.binlog_path

    sphinx.setup && sphinx.start if group.class.metadata[:live]
  end

  config.after :all do |group|
    sphinx.stop if group.class.metadata[:live]
  end

  config.after :suite do
    SphinxController.new.stop
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinking-sphinx-3.4.2 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-3.4.1 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-3.4.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-3.3.0 spec/acceptance/support/sphinx_helpers.rb