summaryrefslogtreecommitdiff
path: root/spec/unit/search/query_spec.rb
diff options
context:
space:
mode:
authorScott Hain <shain@getchef.com>2014-06-26 10:24:14 -0700
committerClaire McQuin <claire@getchef.com>2014-09-04 15:52:23 -0700
commit5846eb62eddd1ca5ac54a1473f3d12805b2c7e97 (patch)
tree05e2a6a9681f9b97ba98db0d1d713a418d5f0157 /spec/unit/search/query_spec.rb
parenta1cf6416ee25b9d477029e6b44333cf41e4929be (diff)
downloadchef-5846eb62eddd1ca5ac54a1473f3d12805b2c7e97.tar.gz
Updated based on awesome feedback
Diffstat (limited to 'spec/unit/search/query_spec.rb')
-rw-r--r--spec/unit/search/query_spec.rb30
1 files changed, 19 insertions, 11 deletions
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb
index 714806ce29..8ab653b6f7 100644
--- a/spec/unit/search/query_spec.rb
+++ b/spec/unit/search/query_spec.rb
@@ -145,7 +145,7 @@ describe Chef::Search::Query do
end
end
- # copypasta existing functionality for new searhc, because new search should at the very least do the same stuff!
+ # copypasta existing functionality for new search, because new search should at the very least do the same stuff!
describe "new search" do
before(:each) do
@response = {
@@ -239,8 +239,10 @@ describe Chef::Search::Query do
@rest.should_receive(:get_rest).with("search/node?q=platform:rhel&sort=id%20desc&start=2&rows=1000").and_return(@response)
@query = Chef::Search::Query.new
args = Hash.new
- args[:sort] = "id desc"
- args[:start] = 2
+ args = {
+ :sort => "id desc",
+ :start => 2
+ }
@query.search(:node, "platform:rhel", args)
end
@@ -248,9 +250,11 @@ describe Chef::Search::Query do
@rest.should_receive(:get_rest).with("search/node?q=platform:rhel&sort=id%20desc&start=2&rows=40").and_return(@response)
@query = Chef::Search::Query.new
args = Hash.new
- args[:sort] = "id desc"
- args[:start] = 2
- args[:rows] = 40
+ args = {
+ :sort => "id desc",
+ :start => 2,
+ :rows => 40
+ }
@query.search(:node, "platform:rhel", args)
end
@@ -271,9 +275,11 @@ describe Chef::Search::Query do
@call_me = double("blocky")
@response["rows"].each { |r| @call_me.should_receive(:do).with(r) }
args = Hash.new
- args[:sort] = nil
- args[:start] = 0
- args[:rows] = 1
+ args = {
+ :sort => nil,
+ :start => 0,
+ :rows => 1
+ }
@query.search(:node, "*:*", args) { |r| @call_me.do(r) }
end
end
@@ -316,8 +322,10 @@ describe Chef::Search::Query do
it "should allow you to filter search results" do
filter_args = Hash.new
- filter_args[:env] = ["chef_environment"]
- filter_args[:ruby_plat] = ["languages", "ruby", "platform"]
+ filter_args = {
+ :env => [ "chef_environment" ],
+ :ruby_plat => [ "languages", "ruby", "platform" ]
+ }
@rest.should_receive(:post_rest).with("search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000", filter_args).and_return(@response)
@query = Chef::Search::Query.new
args = Hash.new