features/step_definitions/common_steps.rb in ts-resque-delta-1.1.5 vs features/step_definitions/common_steps.rb in ts-resque-delta-1.2.0

- old
+ new

@@ -1,8 +1,8 @@ Before do $queries_executed = [] - ThinkingSphinx::Deltas::ResqueDelta.cancel_thinking_sphinx_jobs + ThinkingSphinx::Deltas::ResqueDelta.clear! @model = nil @method = :search @query = "" @conditions = {} @with = {} @@ -18,26 +18,34 @@ Given /^I am searching on (.+)$/ do |model| @model = model.gsub(/\s/, '_').singularize.camelize.constantize end -Given "I have data and it has been indexed" do +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") - ThinkingSphinx::Deltas::ResqueDelta.cancel_thinking_sphinx_jobs +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| @@ -45,9 +53,14 @@ @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,