diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-01-29 14:17:47 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-01-29 14:17:47 -0800 |
commit | b19b7d000887209f9d8dc1dc6aa468a0497a7391 (patch) | |
tree | 68d1eb6c136df20c2800f1dddb4e2c1ed5d75a42 /spec/unit/knife/configure_spec.rb | |
parent | b5c9c6afdfd83fe3f1bf4c991daffeff94b49750 (diff) | |
download | chef-b19b7d000887209f9d8dc1dc6aa468a0497a7391.tar.gz |
s/stub!/stub/g
fix deprecation warnings
Diffstat (limited to 'spec/unit/knife/configure_spec.rb')
-rw-r--r-- | spec/unit/knife/configure_spec.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/unit/knife/configure_spec.rb b/spec/unit/knife/configure_spec.rb index 7c48be6727..d6842ca2c6 100644 --- a/spec/unit/knife/configure_spec.rb +++ b/spec/unit/knife/configure_spec.rb @@ -7,19 +7,19 @@ describe Chef::Knife::Configure do Chef::Config[:node_name] = "webmonkey.example.com" @knife = Chef::Knife::Configure.new @rest_client = mock("null rest client", :post_rest => { :result => :true }) - @knife.stub!(:rest).and_return(@rest_client) + @knife.stub(:rest).and_return(@rest_client) @out = StringIO.new - @knife.ui.stub!(:stdout).and_return(@out) + @knife.ui.stub(:stdout).and_return(@out) @knife.config[:config_file] = '/home/you/.chef/knife.rb' @in = StringIO.new("\n" * 7) - @knife.ui.stub!(:stdin).and_return(@in) + @knife.ui.stub(:stdin).and_return(@in) @err = StringIO.new - @knife.ui.stub!(:stderr).and_return(@err) + @knife.ui.stub(:stderr).and_return(@err) - Ohai::System.stub!(:new).and_return(ohai) + Ohai::System.stub(:new).and_return(ohai) end @@ -49,7 +49,7 @@ describe Chef::Knife::Configure do it "asks the user for the clientname they want for the new client if -i is specified" do @knife.config[:initial] = true - Etc.stub!(:getlogin).and_return("a-new-user") + Etc.stub(:getlogin).and_return("a-new-user") @knife.ask_user_for_config @out.string.should match(Regexp.escape("Please enter a name for the new user: [a-new-user]")) @knife.new_client_name.should == Etc.getlogin @@ -58,14 +58,14 @@ describe Chef::Knife::Configure do it "should not ask the user for the clientname they want for the new client if -i and --node_name are specified" do @knife.config[:initial] = true @knife.config[:node_name] = 'testnode' - Etc.stub!(:getlogin).and_return("a-new-user") + Etc.stub(:getlogin).and_return("a-new-user") @knife.ask_user_for_config @out.string.should_not match(Regexp.escape("Please enter a name for the new user")) @knife.new_client_name.should == 'testnode' end it "asks the user for the existing API username or clientname if -i is not specified" do - Etc.stub!(:getlogin).and_return("a-new-user") + Etc.stub(:getlogin).and_return("a-new-user") @knife.ask_user_for_config @out.string.should match(Regexp.escape("Please enter an existing username or clientname for the API: [a-new-user]")) @knife.new_client_name.should == Etc.getlogin @@ -175,7 +175,7 @@ describe Chef::Knife::Configure do @knife.config[:validation_key] = '/home/you/.chef/my-validation.pem' @knife.config[:repository] = '' @knife.config[:client_key] = '/home/you/a-new-user.pem' - Etc.stub!(:getlogin).and_return('a-new-user') + Etc.stub(:getlogin).and_return('a-new-user') @knife.ask_user_for_config @out.string.should match(/\s*/) @@ -197,10 +197,10 @@ describe Chef::Knife::Configure do end it "writes the new data to a config file" do - File.stub!(:expand_path).with("/home/you/.chef/knife.rb").and_return("/home/you/.chef/knife.rb") - File.stub!(:expand_path).with("/home/you/.chef/#{Etc.getlogin}.pem").and_return("/home/you/.chef/#{Etc.getlogin}.pem") - File.stub!(:expand_path).with(default_validator_key).and_return(default_validator_key) - File.stub!(:expand_path).with(default_admin_key).and_return(default_admin_key) + File.stub(:expand_path).with("/home/you/.chef/knife.rb").and_return("/home/you/.chef/knife.rb") + File.stub(:expand_path).with("/home/you/.chef/#{Etc.getlogin}.pem").and_return("/home/you/.chef/#{Etc.getlogin}.pem") + File.stub(:expand_path).with(default_validator_key).and_return(default_validator_key) + File.stub(:expand_path).with(default_admin_key).and_return(default_admin_key) FileUtils.should_receive(:mkdir_p).with("/home/you/.chef") config_file = StringIO.new ::File.should_receive(:open).with("/home/you/.chef/knife.rb", "w").and_yield config_file @@ -224,9 +224,9 @@ describe Chef::Knife::Configure do user_command = Chef::Knife::UserCreate.new user_command.should_receive(:run) - Etc.stub!(:getlogin).and_return("a-new-user") + Etc.stub(:getlogin).and_return("a-new-user") - Chef::Knife::UserCreate.stub!(:new).and_return(user_command) + Chef::Knife::UserCreate.stub(:new).and_return(user_command) FileUtils.should_receive(:mkdir_p).with("/home/you/.chef") ::File.should_receive(:open).with("/home/you/.chef/knife.rb", "w") @knife.config[:initial] = true |