Sha256: 0c12a44cb2b30ee37b6ce9abb1965533f99020a9257020fb18366d715b4446ed

Contents?: true

Size: 853 Bytes

Versions: 8

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true

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

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

    yield if block_given?

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

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

    sphinx.merge
    sleep 1.5
    sleep 0.5 if ENV['CI']
  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

8 entries across 8 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.5.1 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.5.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.4.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.3.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.2.1 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.2.0 spec/acceptance/support/sphinx_helpers.rb
thinking-sphinx-5.1.0 spec/acceptance/support/sphinx_helpers.rb