Sha256: 0c0888099992ee957828593fe783a7024a1be03b7359661a2bf2f107925a4e14

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

class ThinkingSphinx::Test
  def self.init(suppress_delta_output = true)
    FileUtils.mkdir_p config.indices_location
    config.settings['quiet_deltas'] = true
  end

  def self.start
    config.build
    config.controller.index
    config.controller.start
  end

  def self.start_with_autostop
    autostop
    start
  end

  def self.stop
    config.controller.stop
    sleep(0.5) # Ensure Sphinx has shut down completely
  end

  def self.autostop
    Kernel.at_exit do
      ThinkingSphinx::Test.stop
    end
  end

  def self.run(&block)
    begin
      start
      yield
    ensure
      stop
    end
  end

  def self.config
    @config ||= ::ThinkingSphinx::Configuration.instance
  end

  def self.index(*indexes)
    config.controller.index *indexes
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.0.pre lib/thinking_sphinx/test.rb