summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames FitzGibbon <james.i.fitzgibbon@nordstrom.com>2015-03-04 15:47:25 -0800
committerJames FitzGibbon <james.i.fitzgibbon@nordstrom.com>2015-03-04 15:47:25 -0800
commitf246fe546c965720eadadc01c7318569d2795aba (patch)
tree8415b292818bfa090fd454420fba410efc2adbe6 /spec
parent0bb2861228fd33fd6a4ef296a1dd223abb6dec9f (diff)
downloadchef-f246fe546c965720eadadc01c7318569d2795aba.tar.gz
Add warnings to 'knife node run list remove ...' when the item to be removed doesn't exist
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/node_run_list_remove_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb
index ceceef7178..a279a59635 100644
--- a/spec/unit/knife/node_run_list_remove_spec.rb
+++ b/spec/unit/knife/node_run_list_remove_spec.rb
@@ -84,6 +84,23 @@ describe Chef::Knife::NodeRunListRemove do
expect(@node.run_list).not_to include('role[monkey]')
expect(@node.run_list).not_to include('recipe[duck::type]')
end
+
+ it "should warn when the thing to remove is not in the runlist" do
+ @node.run_list << 'role[blah]'
+ @node.run_list << 'recipe[duck::type]'
+ @knife.name_args = [ 'adam', 'role[blork]' ]
+ expect(@knife.ui).to receive(:warn).with("role[blork] is not in the run list")
+ @knife.run
+ end
+
+ it "should warn even more when the thing to remove is not in the runlist and unqualified" do
+ @node.run_list << 'role[blah]'
+ @node.run_list << 'recipe[duck::type]'
+ @knife.name_args = [ 'adam', 'blork' ]
+ expect(@knife.ui).to receive(:warn).with("blork is not in the run list")
+ expect(@knife.ui).to receive(:warn).with(/did you forget recipe\[\] or role\[\]/)
+ @knife.run
+ end
end
end
end