diff options
author | Mike Fiedler <miketheman@gmail.com> | 2013-05-24 22:09:33 -0400 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-06-18 10:11:06 -0700 |
commit | 8706908bed44e627303bfcca87a48a2e011335e6 (patch) | |
tree | 2db3b938ed65ca83bbb1bd224ad219d15d0c0c44 /spec/unit/knife/node_run_list_set_spec.rb | |
parent | b88df4d6991254740c5b04f7a4032b4d8ba32e12 (diff) | |
download | chef-8706908bed44e627303bfcca87a48a2e011335e6.tar.gz |
Adds another test for correct amount of arguments
@fnichol and I paired on this and come to this method.
We split the tests into two cases for test readability.
Diffstat (limited to 'spec/unit/knife/node_run_list_set_spec.rb')
-rw-r--r-- | spec/unit/knife/node_run_list_set_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/knife/node_run_list_set_spec.rb b/spec/unit/knife/node_run_list_set_spec.rb index 55cfccc90b..bc102695ee 100644 --- a/spec/unit/knife/node_run_list_set_spec.rb +++ b/spec/unit/knife/node_run_list_set_spec.rb @@ -111,5 +111,30 @@ describe Chef::Knife::NodeRunListSet do end end + describe "with no role or recipe" do + # Set up outputs for inspection later + before(:each) do + @stdout = StringIO.new + @stderr = StringIO.new + + @knife.ui.stub!(:stdout).and_return(@stdout) + @knife.ui.stub!(:stderr).and_return(@stderr) + end + + it "should exit" do + @knife.name_args = [ "adam" ] + lambda { @knife.run }.should raise_error SystemExit + end + + it "should show the user" do + @knife.name_args = [ "adam" ] + + begin ; @knife.run ; rescue SystemExit ; end + + @stdout.string.should eq "USAGE: knife node run_list set NODE ENTRIES (options)\n" + @stderr.string.should eq "FATAL: You must supply both a node name and a run list.\n" + end + end + end end |