diff options
author | Thom May <thom@may.lt> | 2015-09-02 13:37:01 +0100 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-09-02 13:37:01 +0100 |
commit | 3a410e9d10ad673f4aafa46ee46f2c8f8d66f7ca (patch) | |
tree | 570fb1bfa8c0efdc4fc51a552e76b7f4c3603670 /spec | |
parent | 1ef5f566480ba84091a12f2b6c5e85f44af54a5b (diff) | |
parent | f246fe546c965720eadadc01c7318569d2795aba (diff) | |
download | chef-3a410e9d10ad673f4aafa46ee46f2c8f8d66f7ca.tar.gz |
Merge pull request #3027 from Nordstrom/warn_on_knife_node_runlist_remove_nochange
Add warnings to 'knife node run list remove ...'
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/node_run_list_remove_spec.rb | 17 |
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 |