diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-30 16:47:40 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-31 13:03:08 -0700 |
commit | f850da7bef6ed732b7b8009d0d0841694d8914bc (patch) | |
tree | df28811df45c0de0dddfc866188d3e6533411345 /spec | |
parent | 5fb94bf7bd7d22fd3a1cff22f5861b0fbf32adb1 (diff) | |
download | chef-f850da7bef6ed732b7b8009d0d0841694d8914bc.tar.gz |
add a few tests
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/search/query_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb index 0837410b3c..95221870d5 100644 --- a/spec/unit/search/query_spec.rb +++ b/spec/unit/search/query_spec.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2009-2016, Chef Software Inc. +# Copyright:: Copyright 2009-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -237,6 +237,27 @@ describe Chef::Search::Query do end end + it "fuzzifies node searches when fuzz is set" do + expect(rest).to receive(:get).with( + "search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0" + ).and_return(response) + query.search(:node, "free.messi", fuzz: true) + end + + it "does not fuzzify node searches when fuzz is not set" do + expect(rest).to receive(:get).with( + "search/node?q=free.messi&start=0" + ).and_return(response) + query.search(:node, "free.messi") + end + + it "does not fuzzify client searches" do + expect(rest).to receive(:get).with( + "search/client?q=messi&start=0" + ).and_return(response) + query.search(:client, "messi", fuzz: true) + end + context "when :filter_result is provided as a result" do include_context "filtered search" do let(:filter_key) { :filter_result } |