Sha256: 9dab446ad1e916eaab6b6284ee2663e9c68217ce5939dcdc802318719887e918

Contents?: true

Size: 798 Bytes

Versions: 9

Compression:

Stored size: 798 Bytes

Contents

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

  def self.start
    config.render_to_file
    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

9 entries across 9 versions & 1 rubygems

Version Path
thinking-sphinx-3.1.0 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.6 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.5 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.4 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.3 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.2 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.1 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.0 lib/thinking_sphinx/test.rb
thinking-sphinx-3.0.0.rc lib/thinking_sphinx/test.rb