Sha256: 1983495108936fbe1d05927215288c4d2832f307cb8c80810473dbfc68b3c80a

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

Before do
  $queries_executed = []
  
  @model      = nil
  @method     = :search
  @query      = ""
  @conditions = {}
  @with       = {}
  @without    = {}
  @with_all   = {}
  @options    = {}
  @results    = nil
end

Given "Sphinx is running" do
  ThinkingSphinx::Configuration.instance.controller.should be_running
end

Given /^I am searching on (.+)$/ do |model|
  @model = model.gsub(/\s/, '_').singularize.camelize.constantize
end

When "I wait for Sphinx to catch up" do
  sleep(0.25)
end

When /^I search for (\w+)$/ do |query|
  @results = nil
  @query = query
end

When /^I search for the document id of (\w+) (\w+) in the (\w+) index$/ do |model, name, index|
  model   = model.gsub(/\s/, '_').camelize.constantize
  @id     = model.find_by_name(name).sphinx_document_id
  @index  = index
end

Then /^I should get (\d+) results?$/ do |count|
  results.length.should == count.to_i
end

Then "it should exist" do
  ThinkingSphinx::Search.search_for_id(@id, @index).should == true
end

Then "it should not exist" do
  ThinkingSphinx::Search.search_for_id(@id, @index).should == false
end

def results
  @results ||= (@model || ThinkingSphinx).send(
    @method,
    @query,
    @options.merge(
      :conditions => @conditions,
      :with       => @with,
      :without    => @without,
      :with_all   => @with_all
    )
  )
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ts-datetime-delta-2.0.2 features/step_definitions/common_steps.rb
ts-datetime-delta-2.0.1 features/step_definitions/common_steps.rb
ts-datetime-delta-2.0.0 features/step_definitions/common_steps.rb
friendlyfashion-ts-datetime-delta-1.0.3 features/step_definitions/common_steps.rb
ts-datetime-delta-1.0.3 features/step_definitions/common_steps.rb
ts-datetime-delta-1.0.2 features/step_definitions/common_steps.rb
ts-datetime-delta-1.0.1 features/step_definitions/common_steps.rb
ts-datetime-delta-1.0.0 features/step_definitions/common_steps.rb