diff options
author | Claire McQuin <claire@getchef.com> | 2014-09-04 12:37:45 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-09-04 15:52:47 -0700 |
commit | 8022a0d89a85787a4b6550428ab26ae37b09b8c0 (patch) | |
tree | a7bcf6ff5d7e677c2c84724bc83519d19bd6c414 /spec/unit/search | |
parent | 260278d883c86dfab0c9bb933bdbe91cae752a3f (diff) | |
download | chef-8022a0d89a85787a4b6550428ab26ae37b09b8c0.tar.gz |
Add InvalidSearchQuery exception for malformed searches.
Diffstat (limited to 'spec/unit/search')
-rw-r--r-- | spec/unit/search/query_spec.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb index 8a890898d3..c7388a6234 100644 --- a/spec/unit/search/query_spec.rb +++ b/spec/unit/search/query_spec.rb @@ -135,7 +135,7 @@ describe Chef::Search::Query do it "should accept a type as the first argument" do lambda { query.search("node") }.should_not raise_error lambda { query.search(:node) }.should_not raise_error - lambda { query.search(Hash.new) }.should raise_error(ArgumentError) + lambda { query.search(Hash.new) }.should raise_error(Chef::Exceptions::InvalidSearchQuery, /(Hash)/) end it "should query for every object of a type by default" do @@ -164,7 +164,8 @@ describe Chef::Search::Query do end it "should throw an exception if you pass to many options" do - lambda { query.search(:node, "platform:rhel", "id desc", 2, 40, "wrong") }.should raise_error(ArgumentError) + lambda { query.search(:node, "platform:rhel", "id desc", 2, 40, "wrong") } + .should raise_error(Chef::Exceptions::InvalidSearchQuery, "Too many arguments! (4 for <= 3)") end it "should return the raw rows, start, and total if no block is passed" do |