diff options
author | Jose Asuncion <jeunito@gmail.com> | 2016-11-21 21:52:54 -0800 |
---|---|---|
committer | Jose Asuncion <jose.asuncion@gmail.com> | 2016-11-29 08:43:51 -0800 |
commit | c50418a71f793e2d2daa729962ccf0ed4a9e0628 (patch) | |
tree | 68e9249ce124f70b50cb1b63cc305ee7cd145e5a /spec | |
parent | 7155ed0447bf558536ed76f109e28fe72848dbe4 (diff) | |
download | chef-c50418a71f793e2d2daa729962ccf0ed4a9e0628.tar.gz |
add multiple node delete
Signed-off-by: Jose Asuncion <jeunito@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/node_delete_spec.rb | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb index d4ef32bccf..46a6b4a1a0 100644 --- a/spec/unit/knife/node_delete_spec.rb +++ b/spec/unit/knife/node_delete_spec.rb @@ -25,12 +25,17 @@ describe Chef::Knife::NodeDelete do @knife.config = { :print_after => nil, } - @knife.name_args = [ "adam" ] + @knife.name_args = [ "adam", "ben" ] allow(@knife).to receive(:output).and_return(true) allow(@knife).to receive(:confirm).and_return(true) - @node = Chef::Node.new() - allow(@node).to receive(:destroy).and_return(true) - allow(Chef::Node).to receive(:load).and_return(@node) + + @adam_node = Chef::Node.new() + @ben_node = Chef::Node.new() + allow(@ben_node).to receive(:destroy).and_return(true) + allow(@adam_node).to receive(:destroy).and_return(true) + allow(Chef::Node).to receive(:load).with("adam").and_return(@adam_node) + allow(Chef::Node).to receive(:load).with("ben").and_return(@ben_node) + @stdout = StringIO.new allow(@knife.ui).to receive(:stdout).and_return(@stdout) end @@ -41,13 +46,15 @@ describe Chef::Knife::NodeDelete do @knife.run end - it "should load the node" do - expect(Chef::Node).to receive(:load).with("adam").and_return(@node) + it "should load the nodes" do + expect(Chef::Node).to receive(:load).with("adam").and_return(@adam_node) + expect(Chef::Node).to receive(:load).with("ben").and_return(@ben_node) @knife.run end - it "should delete the node" do - expect(@node).to receive(:destroy).and_return(@node) + it "should delete the nodes" do + expect(@adam_node).to receive(:destroy).and_return(@adam_node) + expect(@ben_node).to receive(:destroy).and_return(@ben_node) @knife.run end @@ -59,8 +66,10 @@ describe Chef::Knife::NodeDelete do describe "with -p or --print-after" do it "should pretty print the node, formatted for display" do @knife.config[:print_after] = true - expect(@knife).to receive(:format_for_display).with(@node).and_return("poop") - expect(@knife).to receive(:output).with("poop") + expect(@knife).to receive(:format_for_display).with(@adam_node).and_return("adam") + expect(@knife).to receive(:format_for_display).with(@ben_node).and_return("ben") + expect(@knife).to receive(:output).with("adam") + expect(@knife).to receive(:output).with("ben") @knife.run end end |