summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-01-29 10:00:42 -0800
committerGitHub <noreply@github.com>2020-01-29 10:00:42 -0800
commit9f12131d180d53253363396b2a464e515fdc03ac (patch)
tree835f84bffb5426b9c0460424a1c83d6ce8e4b096 /spec
parentdc0241523a9953cf444b3ff40dbf18712564bab9 (diff)
parent166d2fafe541930babcc545c608a8e208188d910 (diff)
downloadchef-9f12131d180d53253363396b2a464e515fdc03ac.tar.gz
Merge pull request #9287 from mimato/fix-knife-fuzzy-search
Fix fuzzy node search to work when the search type is a string rather than a symbol
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/search/query_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb
index 9b0087d7ed..4fbe599d32 100644
--- a/spec/unit/search/query_spec.rb
+++ b/spec/unit/search/query_spec.rb
@@ -233,13 +233,20 @@ describe Chef::Search::Query do
end
end
- it "fuzzifies node searches when fuzz is set" do
+ it "fuzzifies node searches when fuzz is set and type is a symbol" 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&rows=#{default_rows}"
).and_return(response)
query.search(:node, "free.messi", fuzz: true)
end
+ it "fuzzifies node searches when fuzz is set and type is a string" 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&rows=#{default_rows}"
+ ).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&rows=#{default_rows}"