features/step_definitions/common_steps.rb in thinking-sphinx-2.0.5 vs features/step_definitions/common_steps.rb in thinking-sphinx-2.0.6
- old
+ new
@@ -1,18 +1,18 @@
Before do
$queries_executed = []
-
+
@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
@@ -71,11 +71,11 @@
@with[attribute.to_sym] = filter.to_i
end
When /^I filter by (\d\d\d\d)\-(\d\d)\-(\d\d) on (\w+)$/ do |y, m, d, attribute|
@results = nil
- @with[attribute.to_sym] = Time.local(y.to_i, m.to_i, d.to_i).to_i
+ @with[attribute.to_sym] = Time.gm(y.to_i, m.to_i, d.to_i).to_i
end
When /^I filter by (\d+) and (\d+) on (\w+)$/ do |value_one, value_two, attribute|
@results = nil
@with[attribute.to_sym] = [value_one.to_i, value_two.to_i]
@@ -148,11 +148,11 @@
Then /^the (\w+) of each result should indicate order$/ do |attribute|
results.inject(nil) do |prev, current|
unless prev.nil?
current.send(attribute.to_sym).should >= prev.send(attribute.to_sym)
end
-
+
current
end
end
Then /^the first result's "([^"]*)" should be "([^"]*)"$/ do |attribute, value|
@@ -164,10 +164,10 @@
result.should be_kind_of(@model)
unless attribute == "group" && attr_value.nil?
attr_value.should be_kind_of(Integer)
end
}
-
+
results.send("each_with_#{attribute}", &iteration)
end
Then /^I should get (\d+) results?$/ do |count|
results.length.should == count.to_i