Sha256: f613a3adf810e9305fea7b4c78050099b7db064eedc2aa2bfa5d590e31f5af2d

Contents?: true

Size: 869 Bytes

Versions: 9

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

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

  def merge
    sleep 0.5 if ENV['TRAVIS']
    sleep 0.5

    sphinx.merge
    sleep 1.5
    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

9 entries across 9 versions & 1 rubygems

Version Path
thinking-sphinx-5.0.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.4.1 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.4.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.3.2 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.3.1 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.3.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.2.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.1.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-4.0.0 spec/acceptance/support/sphinx_helpers.rb