Class: ThinkingSphinx::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/test.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) autostop



23
24
25
26
27
# File 'lib/thinking_sphinx/test.rb', line 23

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

+ (Object) config



38
39
40
# File 'lib/thinking_sphinx/test.rb', line 38

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

+ (Object) index(*indexes)



42
43
44
# File 'lib/thinking_sphinx/test.rb', line 42

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

+ (Object) init(suppress_delta_output = true)



2
3
4
5
# File 'lib/thinking_sphinx/test.rb', line 2

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

+ (Object) run(&block)



29
30
31
32
33
34
35
36
# File 'lib/thinking_sphinx/test.rb', line 29

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

+ (Object) start



7
8
9
10
11
# File 'lib/thinking_sphinx/test.rb', line 7

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

+ (Object) start_with_autostop



13
14
15
16
# File 'lib/thinking_sphinx/test.rb', line 13

def self.start_with_autostop
  autostop
  start
end

+ (Object) stop



18
19
20
21
# File 'lib/thinking_sphinx/test.rb', line 18

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