diff options
author | Vivek Singh <vivek.singh@msystechnologies.com> | 2019-11-05 19:21:19 +0530 |
---|---|---|
committer | Vivek Singh <vivek.singh@msystechnologies.com> | 2019-11-05 19:21:19 +0530 |
commit | c29b8da2b0353bb5d6e499b5d7cc79c0fadab9b3 (patch) | |
tree | d61162809902543dc8d21c07c77387e7c48781d7 /spec/integration | |
parent | 81d22f6e8cd95254a272d8b303f0b6427b3bc888 (diff) | |
download | chef-c29b8da2b0353bb5d6e499b5d7cc79c0fadab9b3.tar.gz |
Validate name argument for knife list
- Add required specs.
- Raise an error if no argument provided.
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/knife/list_spec.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb index 830dd0e428..c213ef77c4 100644 --- a/spec/integration/knife/list_spec.rb +++ b/spec/integration/knife/list_spec.rb @@ -316,8 +316,12 @@ describe "knife list", :workstation do context "when cwd is at the top of the repository" do before { cwd "." } + it "knife list with no parameters reports an error" do + knife("list").should_fail "FATAL: You must specify at least one argument. If you want to list everything in this directory, run \"knife list .\"\n", stdout: /USAGE/ + end + it "knife list -Rfp returns everything" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM clients/ clients/chef-validator.json clients/chef-webui.json @@ -438,7 +442,7 @@ describe "knife list", :workstation do end it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM cookbook1/ cookbook1/metadata.rb cookbook2/ @@ -457,7 +461,7 @@ describe "knife list", :workstation do before { cwd "cookbooks/cookbook2" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM metadata.rb recipes/ recipes/default.rb @@ -476,7 +480,7 @@ describe "knife list", :workstation do before { cwd "cookbooks" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM cookbook1/ cookbook1/metadata.rb cookbook2/ @@ -491,7 +495,7 @@ describe "knife list", :workstation do before { cwd "symlinked" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM cookbook1/ cookbook1/metadata.rb cookbook2/ @@ -513,7 +517,7 @@ describe "knife list", :workstation do before { cwd "real_cookbooks" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM cookbook1/ cookbook1/metadata.rb cookbook2/ @@ -528,7 +532,7 @@ describe "knife list", :workstation do before { cwd "cookbooks" } it "knife list -Rfp returns cookbooks" do - knife("list -Rfp").should_succeed <<~EOM + knife("list -Rfp .").should_succeed <<~EOM cookbook1/ cookbook1/metadata.rb cookbook2/ |