features/step_definitions/common_steps.rb in warp-thinking-sphinx-1.2.12 vs features/step_definitions/common_steps.rb in warp-thinking-sphinx-1.3.10

- old
+ new

@@ -1,18 +1,19 @@ Before do $queries_executed = [] - ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs @model = nil @method = :search @query = "" @conditions = {} @with = {} @without = {} @with_all = {} @options = {} @results = nil + + Given "updates are enabled" end Given /^I am searching on (.+)$/ do |model| @model = model.gsub(/\s/, '_').singularize.camelize.constantize end @@ -24,10 +25,15 @@ When /^I am searching for ids$/ do @results = nil @method = :search_for_ids end +When /^I use index (.+)$/ do |index| + @results = nil + @options[:index] = index +end + When /^I am retrieving the result count$/ do @result = nil @method = @model ? :search_count : :count end @@ -48,10 +54,14 @@ When /^I search for (\w+) on (\w+)$/ do |query, field| @results = nil @conditions[field.to_sym] = query end +When /^I output the raw result data$/ do + puts results.results.inspect +end + When /^I clear existing filters$/ do @with = {} @without = {} @with_all = {} end @@ -142,10 +152,10 @@ Then /^I can iterate by result and (\w+)$/ do |attribute| iteration = lambda { |result, attr_value| result.should be_kind_of(@model) unless attribute == "group" && attr_value.nil? - attr_value.should be_kind_of(Integer) + attr_value.should be_kind_of(Integer) end } results.send("each_with_#{attribute}", &iteration) end