Sha256: 94b72a7199ba685672a37e48dbd00348ad2862786c884368a67832dd964c5fb8

Contents?: true

Size: 1.6 KB

Versions: 10

Compression:

Stored size: 1.6 KB

Contents

Before do
  $queries_executed = []
  ThinkingSphinx::Deltas::ResqueDelta.clear!
  @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

Given "I have data" do
  DelayedBeta.create(:name => "one")
  DelayedBeta.create(:name => "two")
  DelayedBeta.create(:name => "three")
  DelayedBeta.create(:name => "four")
  DelayedBeta.create(:name => "five")
  DelayedBeta.create(:name => "six")
  DelayedBeta.create(:name => "seven")
  DelayedBeta.create(:name => "eight")
  DelayedBeta.create(:name => "nine")
  DelayedBeta.create(:name => "ten")
end

Given "I have indexed" do
  ThinkingSphinx::Deltas::ResqueDelta.clear!
  ThinkingSphinx::Configuration.instance.controller.index
  sleep(1.5)
end

Given "I have data and it has been indexed" do
  step "I have data"
  step "I have indexed"
end

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

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

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

Then /^I debug$/ do
  debugger
  0
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

10 entries across 10 versions & 2 rubygems

Version Path
ts-resque-delta-1.2.4 features/step_definitions/common_steps.rb
ts-resque-delta-1.2.3 features/step_definitions/common_steps.rb
ts-resque-delta-1.2.2 features/step_definitions/common_steps.rb
ts-resque-delta-1.2.1 features/step_definitions/common_steps.rb
ts-resque-delta-1.2.0 features/step_definitions/common_steps.rb
ryansch-ts-resque-delta-1.1.5.4 features/step_definitions/common_steps.rb
ryansch-ts-resque-delta-1.1.5.4.dev features/step_definitions/common_steps.rb
ryansch-ts-resque-delta-1.1.5.3 features/step_definitions/common_steps.rb
ryansch-ts-resque-delta-1.1.5.2 features/step_definitions/common_steps.rb
ryansch-ts-resque-delta-1.1.5.1 features/step_definitions/common_steps.rb