summaryrefslogtreecommitdiff
path: root/spec/unit/knife
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/knife')
-rw-r--r--spec/unit/knife/bootstrap_spec.rb34
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb8
-rw-r--r--spec/unit/knife/client_create_spec.rb12
-rw-r--r--spec/unit/knife/client_reregister_spec.rb2
-rw-r--r--spec/unit/knife/config_file_selection_spec.rb8
-rw-r--r--spec/unit/knife/configure_client_spec.rb8
-rw-r--r--spec/unit/knife/configure_spec.rb30
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb18
-rw-r--r--spec/unit/knife/cookbook_create_spec.rb10
-rw-r--r--spec/unit/knife/cookbook_delete_spec.rb10
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb14
-rw-r--r--spec/unit/knife/cookbook_list_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_metadata_from_file_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_metadata_spec.rb12
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb6
-rw-r--r--spec/unit/knife/cookbook_site_install_spec.rb16
-rw-r--r--spec/unit/knife/cookbook_site_share_spec.rb40
-rw-r--r--spec/unit/knife/cookbook_site_unshare_spec.rb10
-rw-r--r--spec/unit/knife/cookbook_test_spec.rb14
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb34
-rw-r--r--spec/unit/knife/core/cookbook_scm_repo_spec.rb12
-rw-r--r--spec/unit/knife/core/object_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/ui_spec.rb18
-rw-r--r--spec/unit/knife/data_bag_create_spec.rb8
-rw-r--r--spec/unit/knife/data_bag_edit_spec.rb12
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb28
-rw-r--r--spec/unit/knife/data_bag_show_spec.rb8
-rw-r--r--spec/unit/knife/environment_create_spec.rb12
-rw-r--r--spec/unit/knife/environment_delete_spec.rb12
-rw-r--r--spec/unit/knife/environment_edit_spec.rb10
-rw-r--r--spec/unit/knife/environment_from_file_spec.rb14
-rw-r--r--spec/unit/knife/environment_list_spec.rb8
-rw-r--r--spec/unit/knife/environment_show_spec.rb8
-rw-r--r--spec/unit/knife/index_rebuild_spec.rb2
-rw-r--r--spec/unit/knife/knife_help.rb22
-rw-r--r--spec/unit/knife/node_bulk_delete_spec.rb8
-rw-r--r--spec/unit/knife/node_delete_spec.rb10
-rw-r--r--spec/unit/knife/node_edit_spec.rb4
-rw-r--r--spec/unit/knife/node_from_file_spec.rb10
-rw-r--r--spec/unit/knife/node_list_spec.rb6
-rw-r--r--spec/unit/knife/node_run_list_add_spec.rb6
-rw-r--r--spec/unit/knife/node_run_list_remove_spec.rb8
-rw-r--r--spec/unit/knife/node_run_list_set_spec.rb10
-rw-r--r--spec/unit/knife/node_show_spec.rb4
-rw-r--r--spec/unit/knife/role_bulk_delete_spec.rb8
-rw-r--r--spec/unit/knife/role_create_spec.rb10
-rw-r--r--spec/unit/knife/role_delete_spec.rb10
-rw-r--r--spec/unit/knife/role_edit_spec.rb10
-rw-r--r--spec/unit/knife/role_from_file_spec.rb10
-rw-r--r--spec/unit/knife/role_list_spec.rb4
-rw-r--r--spec/unit/knife/ssh_spec.rb12
-rw-r--r--spec/unit/knife/status_spec.rb6
-rw-r--r--spec/unit/knife/tag_create_spec.rb6
-rw-r--r--spec/unit/knife/tag_delete_spec.rb6
-rw-r--r--spec/unit/knife/tag_list_spec.rb4
-rw-r--r--spec/unit/knife/user_create_spec.rb12
-rw-r--r--spec/unit/knife/user_reregister_spec.rb4
57 files changed, 319 insertions, 319 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index cc0336d8f6..b055cadcee 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -29,9 +29,9 @@ describe Chef::Knife::Bootstrap do
@knife.merge_configs
@knife.config[:template_file] = File.expand_path(File.join(CHEF_SPEC_DATA, "bootstrap", "test.erb"))
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
@stderr = StringIO.new
- @knife.ui.stub!(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stderr).and_return(@stderr)
end
it "should return a name of default bootstrap template" do
@@ -47,8 +47,8 @@ describe Chef::Knife::Bootstrap do
it "should look for templates early in the run" do
File.stub(:exists?).and_return(true)
@knife.name_args = ['shatner']
- @knife.stub!(:read_template).and_return("")
- @knife.stub!(:knife_ssh).and_return(true)
+ @knife.stub(:read_template).and_return("")
+ @knife.stub(:knife_ssh).and_return(true)
@knife_ssh = @knife.knife_ssh
@knife.should_receive(:find_template).ordered
@knife.should_receive(:knife_ssh).ordered
@@ -110,10 +110,10 @@ describe Chef::Knife::Bootstrap do
it "should populate a hint file with JSON when given a file to read" do
@knife.stub(:find_template).and_return(true)
@knife.config[:template_file] = File.expand_path(File.join(CHEF_SPEC_DATA, "bootstrap", "test-hints.erb"))
- ::File.stub!(:read).and_return('{ "foo" : "bar" }')
+ ::File.stub(:read).and_return('{ "foo" : "bar" }')
@knife.instance_variable_set("@template_file", @knife.config[:template_file])
template_string = @knife.read_template
- @knife.stub!(:read_template).and_return('{ "foo" : "bar" }')
+ @knife.stub(:read_template).and_return('{ "foo" : "bar" }')
@knife.parse_options(["--hint", "openstack=hints/openstack.json"])
@knife.render_template(template_string).should match /\{\"foo\":\"bar\"\}/
end
@@ -214,7 +214,7 @@ describe Chef::Knife::Bootstrap do
Chef::Config[:knife][:ssh_port] = nil
@knife.config[:forward_agent] = true
@knife.config[:identity_file] = "~/.ssh/me.rsa"
- @knife.stub!(:read_template).and_return("")
+ @knife.stub(:read_template).and_return("")
@knife_ssh = @knife.knife_ssh
end
@@ -282,7 +282,7 @@ describe Chef::Knife::Bootstrap do
Chef::Config[:knife][:identity_file] = "~/.ssh/you.rsa"
Chef::Config[:knife][:ssh_gateway] = "towel.blinkenlights.nl"
Chef::Config[:knife][:host_key_verify] = true
- @knife.stub!(:read_template).and_return("")
+ @knife.stub(:read_template).and_return("")
@knife_ssh = @knife.knife_ssh
end
@@ -316,20 +316,20 @@ describe Chef::Knife::Bootstrap do
@knife.name_args = ["foo.example.com"]
@knife.config[:ssh_user] = "rooty"
@knife.config[:identity_file] = "~/.ssh/me.rsa"
- @knife.stub!(:read_template).and_return("")
+ @knife.stub(:read_template).and_return("")
@knife_ssh = @knife.knife_ssh
end
it "prompts the user for a password " do
- @knife.stub!(:knife_ssh).and_return(@knife_ssh)
- @knife_ssh.stub!(:get_password).and_return('typed_in_password')
+ @knife.stub(:knife_ssh).and_return(@knife_ssh)
+ @knife_ssh.stub(:get_password).and_return('typed_in_password')
alternate_knife_ssh = @knife.knife_ssh_with_password_auth
alternate_knife_ssh.config[:ssh_password].should == 'typed_in_password'
end
it "configures knife not to use the identity file that didn't work previously" do
- @knife.stub!(:knife_ssh).and_return(@knife_ssh)
- @knife_ssh.stub!(:get_password).and_return('typed_in_password')
+ @knife.stub(:knife_ssh).and_return(@knife_ssh)
+ @knife_ssh.stub(:get_password).and_return('typed_in_password')
alternate_knife_ssh = @knife.knife_ssh_with_password_auth
alternate_knife_ssh.config[:identity_file].should be_nil
end
@@ -341,9 +341,9 @@ describe Chef::Knife::Bootstrap do
@knife.name_args = ["foo.example.com"]
@knife.config[:ssh_user] = "rooty"
@knife.config[:identity_file] = "~/.ssh/me.rsa"
- @knife.stub!(:read_template).and_return("")
+ @knife.stub(:read_template).and_return("")
@knife_ssh = @knife.knife_ssh
- @knife.stub!(:knife_ssh).and_return(@knife_ssh)
+ @knife.stub(:knife_ssh).and_return(@knife_ssh)
end
it "verifies that a server to bootstrap was given as a command line arg" do
@@ -358,11 +358,11 @@ describe Chef::Knife::Bootstrap do
end
it "falls back to password based auth when auth fails the first time" do
- @knife.stub!(:puts)
+ @knife.stub(:puts)
@fallback_knife_ssh = @knife_ssh.dup
@knife_ssh.should_receive(:run).and_raise(Net::SSH::AuthenticationFailed.new("no ssh for you"))
- @knife.stub!(:knife_ssh_with_password_auth).and_return(@fallback_knife_ssh)
+ @knife.stub(:knife_ssh_with_password_auth).and_return(@fallback_knife_ssh)
@fallback_knife_ssh.should_receive(:run)
@knife.run
end
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index b7864ed098..bedd4911c5 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -26,16 +26,16 @@ describe Chef::Knife::ClientBulkDelete do
@knife = Chef::Knife::ClientBulkDelete.new
@knife.name_args = ["."]
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:confirm).and_return(true)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:confirm).and_return(true)
@clients = Hash.new
%w{tim dan stephen}.each do |client_name|
client = Chef::ApiClient.new()
client.name(client_name)
- client.stub!(:destroy).and_return(true)
+ client.stub(:destroy).and_return(true)
@clients[client_name] = client
end
- Chef::ApiClient.stub!(:list).and_return(@clients)
+ Chef::ApiClient.stub(:list).and_return(@clients)
end
describe "run" do
diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb
index d07b6ceb17..8ddc5200b0 100644
--- a/spec/unit/knife/client_create_spec.rb
+++ b/spec/unit/knife/client_create_spec.rb
@@ -29,12 +29,12 @@ describe Chef::Knife::ClientCreate do
}
@knife.name_args = [ "adam" ]
@client = Chef::ApiClient.new
- @client.stub!(:save).and_return({ 'private_key' => '' })
- @knife.stub!(:edit_data).and_return(@client)
- @knife.stub!(:puts)
- Chef::ApiClient.stub!(:new).and_return(@client)
+ @client.stub(:save).and_return({ 'private_key' => '' })
+ @knife.stub(:edit_data).and_return(@client)
+ @knife.stub(:puts)
+ Chef::ApiClient.stub(:new).and_return(@client)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
@@ -62,7 +62,7 @@ describe Chef::Knife::ClientCreate do
describe "with -f or --file" do
it "should write the private key to a file" do
@knife.config[:file] = "/tmp/monkeypants"
- @client.stub!(:save).and_return({ 'private_key' => "woot" })
+ @client.stub(:save).and_return({ 'private_key' => "woot" })
filehandle = mock("Filehandle")
filehandle.should_receive(:print).with('woot')
File.should_receive(:open).with("/tmp/monkeypants", "w").and_yield(filehandle)
diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb
index d84978c497..b03071b973 100644
--- a/spec/unit/knife/client_reregister_spec.rb
+++ b/spec/unit/knife/client_reregister_spec.rb
@@ -24,7 +24,7 @@ describe Chef::Knife::ClientReregister do
@knife.name_args = [ 'adam' ]
@client_mock = mock('client_mock', :private_key => "foo_key")
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
context "when no client name is given on the command line" do
diff --git a/spec/unit/knife/config_file_selection_spec.rb b/spec/unit/knife/config_file_selection_spec.rb
index 127e89be9b..0a623714d7 100644
--- a/spec/unit/knife/config_file_selection_spec.rb
+++ b/spec/unit/knife/config_file_selection_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Knife do
end
before :each do
- Chef::Config.stub!(:from_file).and_return(true)
+ Chef::Config.stub(:from_file).and_return(true)
Chef::ConfigFetcher.stub(:new).and_return(missing_config_fetcher)
end
@@ -72,7 +72,7 @@ describe Chef::Knife do
upward_dir = File.expand_path "#{Dir.pwd}/.chef"
upward_config = File.expand_path "#{upward_dir}/knife.rb"
have_config_file(upward_config)
- Chef::Knife.stub!(:chef_config_dir).and_return(upward_dir)
+ Chef::Knife.stub(:chef_config_dir).and_return(upward_dir)
@knife = Chef::Knife.new
@knife.configure_chef
@@ -89,7 +89,7 @@ describe Chef::Knife do
end
it "configure knife from nothing" do
- ::File.stub!(:exist?).and_return(false)
+ ::File.stub(:exist?).and_return(false)
@knife = Chef::Knife.new
@knife.ui.should_receive(:warn).with("No knife configuration file found")
@knife.configure_chef
@@ -104,7 +104,7 @@ describe Chef::Knife do
home_config = File.expand_path(File.join("#{ENV['HOME']}", "/.chef/knife.rb"))
configs = [ env_config, pwd_config, upward_config, home_config ]
- Chef::Knife.stub!(:chef_config_dir).and_return(upward_dir)
+ Chef::Knife.stub(:chef_config_dir).and_return(upward_dir)
ENV['KNIFE_HOME'] = Dir.tmpdir
@knife = Chef::Knife.new
diff --git a/spec/unit/knife/configure_client_spec.rb b/spec/unit/knife/configure_client_spec.rb
index ba832103bc..d101780317 100644
--- a/spec/unit/knife/configure_client_spec.rb
+++ b/spec/unit/knife/configure_client_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Knife::ConfigureClient do
Chef::Config[:validation_key] = '/etc/chef/validation.pem'
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe 'run' do
@@ -56,7 +56,7 @@ describe Chef::Knife::ConfigureClient do
end
it 'should write out the config file' do
- FileUtils.stub!(:mkdir_p)
+ FileUtils.stub(:mkdir_p)
@knife.run
@client_file.string.should match /log_level\s+\:info/
@client_file.string.should match /log_location\s+STDOUT/
@@ -65,13 +65,13 @@ describe Chef::Knife::ConfigureClient do
end
it 'should write out the validation.pem file' do
- FileUtils.stub!(:mkdir_p)
+ FileUtils.stub(:mkdir_p)
@knife.run
@validation_file.string.should match /foo_bar_baz/
end
it 'should print information on what is being configured' do
- FileUtils.stub!(:mkdir_p)
+ FileUtils.stub(:mkdir_p)
@knife.run
@stdout.string.should match /creating client configuration/i
@stdout.string.should match /writing client\.rb/i
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
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index ced2a9a4e4..2dcc276ad2 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -27,18 +27,18 @@ describe Chef::Knife::CookbookBulkDelete do
@knife.config = {:print_after => nil}
@knife.name_args = ["."]
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:confirm).and_return(true)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:confirm).and_return(true)
@cookbooks = Hash.new
%w{cheezburger pizza lasagna}.each do |cookbook_name|
cookbook = Chef::CookbookVersion.new(cookbook_name)
@cookbooks[cookbook_name] = cookbook
end
@rest = mock("Chef::REST")
- @rest.stub!(:get_rest).and_return(@cookbooks)
- @rest.stub!(:delete_rest).and_return(true)
- @knife.stub!(:rest).and_return(@rest)
- Chef::CookbookVersion.stub!(:list).and_return(@cookbooks)
+ @rest.stub(:get_rest).and_return(@cookbooks)
+ @rest.stub(:delete_rest).and_return(true)
+ @knife.stub(:rest).and_return(@rest)
+ Chef::CookbookVersion.stub(:list).and_return(@cookbooks)
end
@@ -47,11 +47,11 @@ describe Chef::Knife::CookbookBulkDelete do
describe "when there are several cookbooks on the server" do
before do
@cheezburger = {'cheezburger' => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-cheez", "version" => "1.0.0"}]}}
- @rest.stub!(:get_rest).with('cookbooks/cheezburger').and_return(@cheezburger)
+ @rest.stub(:get_rest).with('cookbooks/cheezburger').and_return(@cheezburger)
@pizza = {'pizza' => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-pizza", "version" => "2.0.0"}]}}
- @rest.stub!(:get_rest).with('cookbooks/pizza').and_return(@pizza)
+ @rest.stub(:get_rest).with('cookbooks/pizza').and_return(@pizza)
@lasagna = {'lasagna' => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-lasagna", "version" => "3.0.0"}]}}
- @rest.stub!(:get_rest).with('cookbooks/lasagna').and_return(@lasagna)
+ @rest.stub(:get_rest).with('cookbooks/lasagna').and_return(@lasagna)
end
it "should print the cookbooks you are about to delete" do
diff --git a/spec/unit/knife/cookbook_create_spec.rb b/spec/unit/knife/cookbook_create_spec.rb
index 7891115285..06475d3ac9 100644
--- a/spec/unit/knife/cookbook_create_spec.rb
+++ b/spec/unit/knife/cookbook_create_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Knife::CookbookCreate do
@knife.config = {}
@knife.name_args = ["foobar"]
@stdout = StringIO.new
- @knife.stub!(:stdout).and_return(@stdout)
+ @knife.stub(:stdout).and_return(@stdout)
end
describe "run" do
@@ -35,10 +35,10 @@ describe Chef::Knife::CookbookCreate do
it "should expand the path of the cookbook directory" do
File.should_receive(:expand_path).with("~/tmp/monkeypants")
@knife.config = {:cookbook_path => "~/tmp/monkeypants"}
- @knife.stub!(:create_cookbook)
- @knife.stub!(:create_readme)
- @knife.stub!(:create_changelog)
- @knife.stub!(:create_metadata)
+ @knife.stub(:create_cookbook)
+ @knife.stub(:create_readme)
+ @knife.stub(:create_changelog)
+ @knife.stub(:create_metadata)
@knife.run
end
diff --git a/spec/unit/knife/cookbook_delete_spec.rb b/spec/unit/knife/cookbook_delete_spec.rb
index afaa3b69a5..79ec6769ec 100644
--- a/spec/unit/knife/cookbook_delete_spec.rb
+++ b/spec/unit/knife/cookbook_delete_spec.rb
@@ -24,9 +24,9 @@ describe Chef::Knife::CookbookDelete do
@knife.name_args = ['foobar']
@knife.cookbook_name = 'foobar'
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
@stderr = StringIO.new
- @knife.ui.stub!(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stderr).and_return(@stderr)
end
describe 'run' do
@@ -163,7 +163,7 @@ describe Chef::Knife::CookbookDelete do
describe 'ask_which_version_to_delete' do
before(:each) do
- @knife.stub!(:available_versions).and_return(['1.0.0', '1.1.0', '2.0.0'])
+ @knife.stub(:available_versions).and_return(['1.0.0', '1.1.0', '2.0.0'])
end
it 'should prompt the user to select a version' do
@@ -202,7 +202,7 @@ describe Chef::Knife::CookbookDelete do
end
it 'should output that the cookbook was deleted' do
- @knife.stub!(:delete_request)
+ @knife.stub(:delete_request)
@knife.delete_version_without_confirmation('1.0.0')
@stdout.string.should match /deleted cookbook\[foobar\]\[1.0.0\]/im
end
@@ -211,7 +211,7 @@ describe Chef::Knife::CookbookDelete do
it 'should display the cookbook data' do
object = ''
@knife.config[:print_after] = true
- @knife.stub!(:delete_request).and_return(object)
+ @knife.stub(:delete_request).and_return(object)
@knife.should_receive(:format_for_display).with(object)
@knife.delete_version_without_confirmation('1.0.0')
end
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index cc3c300fdf..96b5a860b3 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Knife::CookbookDownload do
before(:each) do
@knife = Chef::Knife::CookbookDownload.new
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe 'run' do
@@ -67,17 +67,17 @@ describe Chef::Knife::CookbookDownload do
}
@cookbook_mock = mock('cookbook')
- @cookbook_mock.stub!(:version).and_return('1.0.0')
- @cookbook_mock.stub!(:manifest).and_return(@manifest_data)
+ @cookbook_mock.stub(:version).and_return('1.0.0')
+ @cookbook_mock.stub(:manifest).and_return(@manifest_data)
@rest_mock.should_receive(:get_rest).with('cookbooks/foobar/1.0.0').
and_return(@cookbook_mock)
end
it 'should determine which version if one was not explicitly specified'do
- @cookbook_mock.stub!(:manifest).and_return({})
+ @cookbook_mock.stub(:manifest).and_return({})
@knife.should_receive(:determine_version).and_return('1.0.0')
File.should_receive(:exists?).with('/var/tmp/chef/foobar-1.0.0').and_return(false)
- Chef::CookbookVersion.stub!(:COOKBOOK_SEGEMENTS).and_return([])
+ Chef::CookbookVersion.stub(:COOKBOOK_SEGEMENTS).and_return([])
@knife.run
end
@@ -88,7 +88,7 @@ describe Chef::Knife::CookbookDownload do
@files_mocks = {}
@files.map { |f| File.basename(f) }.flatten.uniq.each do |f|
@files_mocks[f] = mock("#{f}_mock")
- @files_mocks[f].stub!(:path).and_return("/var/tmp/#{f}")
+ @files_mocks[f].stub(:path).and_return("/var/tmp/#{f}")
end
end
@@ -207,7 +207,7 @@ describe Chef::Knife::CookbookDownload do
describe 'ask_which_version' do
before(:each) do
@knife.cookbook_name = 'foobar'
- @knife.stub!(:available_versions).and_return(['1.0.0', '1.1.0', '2.0.0'])
+ @knife.stub(:available_versions).and_return(['1.0.0', '1.1.0', '2.0.0'])
end
it 'should prompt the user to select a version' do
diff --git a/spec/unit/knife/cookbook_list_spec.rb b/spec/unit/knife/cookbook_list_spec.rb
index db6f061bd1..5482d5d33c 100644
--- a/spec/unit/knife/cookbook_list_spec.rb
+++ b/spec/unit/knife/cookbook_list_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Knife::CookbookList do
before do
@knife = Chef::Knife::CookbookList.new
@rest_mock = mock('rest')
- @knife.stub!(:rest).and_return(@rest_mock)
+ @knife.stub(:rest).and_return(@rest_mock)
@cookbook_names = ['apache2', 'mysql']
@base_url = 'https://server.example.com/cookbooks'
@cookbook_data = {}
@@ -32,7 +32,7 @@ describe Chef::Knife::CookbookList do
'url' => "#{@base_url}/#{item}/1.0.1"}]}
end
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe 'run' do
diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
index 6f406de6b7..68ab6740ab 100644
--- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
@@ -27,10 +27,10 @@ describe Chef::Knife::CookbookMetadataFromFile do
@tgt = File.expand_path(File.join(CHEF_SPEC_DATA, "metadata", "quick_start", "metadata.json"))
@knife = Chef::Knife::CookbookMetadataFromFile.new
@knife.name_args = [ @src ]
- @knife.stub!(:to_json_pretty).and_return(true)
+ @knife.stub(:to_json_pretty).and_return(true)
@md = Chef::Cookbook::Metadata.new
Chef::Cookbook::Metadata.stub(:new).and_return(@md)
- $stdout.stub!(:write)
+ $stdout.stub(:write)
end
after do
diff --git a/spec/unit/knife/cookbook_metadata_spec.rb b/spec/unit/knife/cookbook_metadata_spec.rb
index c664326a3d..11d8613590 100644
--- a/spec/unit/knife/cookbook_metadata_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_spec.rb
@@ -26,8 +26,8 @@ describe Chef::Knife::CookbookMetadata do
@json_data = '{ "version": "1.0.0" }'
@stdout = StringIO.new
@stderr = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stderr).and_return(@stderr)
end
describe 'run' do
@@ -84,7 +84,7 @@ describe Chef::Knife::CookbookMetadata do
describe 'generate_metadata' do
before(:each) do
@knife.config[:cookbook_path] = @cookbook_dir
- File.stub!(:expand_path).with("#{@cookbook_dir}/foobar/metadata.rb").
+ File.stub(:expand_path).with("#{@cookbook_dir}/foobar/metadata.rb").
and_return("#{@cookbook_dir}/foobar/metadata.rb")
end
@@ -110,7 +110,7 @@ describe Chef::Knife::CookbookMetadata do
end
it 'should generate the metatdata json from metatdata.rb' do
- Chef::Cookbook::Metadata.stub!(:new).and_return(@metadata_mock)
+ Chef::Cookbook::Metadata.stub(:new).and_return(@metadata_mock)
@metadata_mock.should_receive(:name).with('foobar')
@metadata_mock.should_receive(:from_file).with("#{@cookbook_dir}/foobar/metadata.rb")
File.should_receive(:open).with("#{@cookbook_dir}/foobar/metadata.json", 'w').
@@ -127,7 +127,7 @@ describe Chef::Knife::CookbookMetadata do
}.each_pair do |klass, description|
it "should print an error and exit when an #{description} syntax exception is encountered" do
exception = klass.new("#{description} blah")
- Chef::Cookbook::Metadata.stub!(:new).and_raise(exception)
+ Chef::Cookbook::Metadata.stub(:new).and_raise(exception)
lambda {
@knife.generate_metadata_from_file('foobar', "#{@cookbook_dir}/foobar/metadata.rb")
}.should raise_error(SystemExit)
@@ -165,7 +165,7 @@ describe Chef::Knife::CookbookMetadata do
IO.should_receive(:read).with("#{@cookbook_dir}/foobar/metadata.json").
and_return(@json_data)
exception = klass.new("#{description} blah")
- Chef::Cookbook::Metadata.stub!(:validate_json).and_raise(exception)
+ Chef::Cookbook::Metadata.stub(:validate_json).and_raise(exception)
lambda {
@knife.validate_metadata_json(@cookbook_dir, 'foobar')
}.should raise_error(SystemExit)
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index 96fe738b0b..44f7064a64 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -26,9 +26,9 @@ describe Chef::Knife::CookbookShow do
@knife.config = { }
@knife.name_args = [ "cookbook_name" ]
@rest = mock(Chef::REST)
- @knife.stub!(:rest).and_return(@rest)
- @knife.stub!(:pretty_print).and_return(true)
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:rest).and_return(@rest)
+ @knife.stub(:pretty_print).and_return(true)
+ @knife.stub(:output).and_return(true)
end
describe "run" do
diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb
index f7d7a397e6..3086c817d9 100644
--- a/spec/unit/knife/cookbook_site_install_spec.rb
+++ b/spec/unit/knife/cookbook_site_install_spec.rb
@@ -32,18 +32,18 @@ describe Chef::Knife::CookbookSiteInstall do
@stdout = StringIO.new
@stderr = StringIO.new
- @knife.stub!(:stderr).and_return(@stdout)
- @knife.stub!(:stdout).and_return(@stdout)
+ @knife.stub(:stderr).and_return(@stdout)
+ @knife.stub(:stdout).and_return(@stdout)
#Assume all external commands would have succeed. :(
- File.stub!(:unlink)
- File.stub!(:rmtree)
- @knife.stub!(:shell_out!).and_return(true)
+ File.stub(:unlink)
+ File.stub(:rmtree)
+ @knife.stub(:shell_out!).and_return(true)
#CookbookSiteDownload Stup
@downloader = {}
- @knife.stub!(:download_cookbook_to).and_return(@downloader)
- @downloader.stub!(:version).and_return do
+ @knife.stub(:download_cookbook_to).and_return(@downloader)
+ @downloader.stub(:version).and_return do
if @knife.name_args.size == 2
@knife.name_args[1]
else
@@ -55,7 +55,7 @@ describe Chef::Knife::CookbookSiteInstall do
@repo = stub(:sanity_check => true, :reset_to_default_state => true,
:prepare_to_import => true, :finalize_updates_to => true,
:merge_updates_from => true)
- Chef::Knife::CookbookSCMRepo.stub!(:new).and_return(@repo)
+ Chef::Knife::CookbookSCMRepo.stub(:new).and_return(@repo)
end
diff --git a/spec/unit/knife/cookbook_site_share_spec.rb b/spec/unit/knife/cookbook_site_share_spec.rb
index 3b912af0c5..b89223b1eb 100644
--- a/spec/unit/knife/cookbook_site_share_spec.rb
+++ b/spec/unit/knife/cookbook_site_share_spec.rb
@@ -30,24 +30,24 @@ describe Chef::Knife::CookbookSiteShare do
@cookbook = Chef::CookbookVersion.new('cookbook_name')
@cookbook_loader = mock('Chef::CookbookLoader')
- @cookbook_loader.stub!(:cookbook_exists?).and_return(true)
- @cookbook_loader.stub!(:[]).and_return(@cookbook)
- Chef::CookbookLoader.stub!(:new).and_return(@cookbook_loader)
+ @cookbook_loader.stub(:cookbook_exists?).and_return(true)
+ @cookbook_loader.stub(:[]).and_return(@cookbook)
+ Chef::CookbookLoader.stub(:new).and_return(@cookbook_loader)
@cookbook_uploader = Chef::CookbookUploader.new('herpderp', File.join(CHEF_SPEC_DATA, 'cookbooks'), :rest => "norest")
- Chef::CookbookUploader.stub!(:new).and_return(@cookbook_uploader)
- @cookbook_uploader.stub!(:validate_cookbooks).and_return(true)
- Chef::CookbookSiteStreamingUploader.stub!(:create_build_dir).and_return(Dir.mktmpdir)
+ Chef::CookbookUploader.stub(:new).and_return(@cookbook_uploader)
+ @cookbook_uploader.stub(:validate_cookbooks).and_return(true)
+ Chef::CookbookSiteStreamingUploader.stub(:create_build_dir).and_return(Dir.mktmpdir)
Chef::Mixin::Command.stub(:run_command).and_return(true)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe 'run' do
before(:each) do
- @knife.stub!(:do_upload).and_return(true)
+ @knife.stub(:do_upload).and_return(true)
end
it 'should should print usage and exit when given no arguments' do
@@ -83,7 +83,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should exit and log to error when the tarball creation fails' do
- Chef::Mixin::Command.stub!(:run_command).and_raise(Chef::Exceptions::Exec)
+ Chef::Mixin::Command.stub(:run_command).and_raise(Chef::Exceptions::Exec)
@knife.ui.should_receive(:error)
lambda { @knife.run }.should raise_error(SystemExit)
end
@@ -99,43 +99,43 @@ describe Chef::Knife::CookbookSiteShare do
before(:each) do
@upload_response = mock('Net::HTTPResponse')
- Chef::CookbookSiteStreamingUploader.stub!(:post).and_return(@upload_response)
+ Chef::CookbookSiteStreamingUploader.stub(:post).and_return(@upload_response)
@stdout = StringIO.new
@stderr = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stderr).and_return(@stderr)
File.stub(:open).and_return(true)
end
it 'should post the cookbook to "http://cookbooks.opscode.com"' do
response_text = {:uri => 'http://cookbooks.opscode.com/cookbooks/cookbook_name'}.to_json
- @upload_response.stub!(:body).and_return(response_text)
- @upload_response.stub!(:code).and_return(201)
+ @upload_response.stub(:body).and_return(response_text)
+ @upload_response.stub(:code).and_return(201)
Chef::CookbookSiteStreamingUploader.should_receive(:post).with(/cookbooks\.opscode\.com/, anything(), anything(), anything())
@knife.run
end
it 'should alert the user when a version already exists' do
response_text = {:error_messages => ['Version already exists']}.to_json
- @upload_response.stub!(:body).and_return(response_text)
- @upload_response.stub!(:code).and_return(409)
+ @upload_response.stub(:body).and_return(response_text)
+ @upload_response.stub(:code).and_return(409)
lambda { @knife.run }.should raise_error(SystemExit)
@stderr.string.should match(/ERROR(.+)cookbook already exists/)
end
it 'should pass any errors on to the user' do
response_text = {:error_messages => ["You're holding it wrong"]}.to_json
- @upload_response.stub!(:body).and_return(response_text)
- @upload_response.stub!(:code).and_return(403)
+ @upload_response.stub(:body).and_return(response_text)
+ @upload_response.stub(:code).and_return(403)
lambda { @knife.run }.should raise_error(SystemExit)
@stderr.string.should match("ERROR(.*)You're holding it wrong")
end
it 'should print the body if no errors are exposed on failure' do
response_text = {:system_error => "Your call was dropped", :reason => "There's a map for that"}.to_json
- @upload_response.stub!(:body).and_return(response_text)
- @upload_response.stub!(:code).and_return(500)
+ @upload_response.stub(:body).and_return(response_text)
+ @upload_response.stub(:code).and_return(500)
@knife.ui.should_receive(:error).with(/#{Regexp.escape(response_text)}/)#.ordered
@knife.ui.should_receive(:error).with(/Unknown error/)#.ordered
lambda { @knife.run }.should raise_error(SystemExit)
diff --git a/spec/unit/knife/cookbook_site_unshare_spec.rb b/spec/unit/knife/cookbook_site_unshare_spec.rb
index ffba2ec664..65318f03e0 100644
--- a/spec/unit/knife/cookbook_site_unshare_spec.rb
+++ b/spec/unit/knife/cookbook_site_unshare_spec.rb
@@ -24,13 +24,13 @@ describe Chef::Knife::CookbookSiteUnshare do
before(:each) do
@knife = Chef::Knife::CookbookSiteUnshare.new
@knife.name_args = ['cookbook_name']
- @knife.stub!(:confirm).and_return(true)
+ @knife.stub(:confirm).and_return(true)
@rest = mock('Chef::REST')
- @rest.stub!(:delete_rest).and_return(true)
- @knife.stub!(:rest).and_return(@rest)
+ @rest.stub(:delete_rest).and_return(true)
+ @knife.stub(:rest).and_return(@rest)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe 'run' do
@@ -56,7 +56,7 @@ describe Chef::Knife::CookbookSiteUnshare do
it 'should log an error and exit when forbidden' do
exception = mock('403 "Forbidden"', :code => '403')
- @rest.stub!(:delete_rest).and_raise(Net::HTTPServerException.new('403 "Forbidden"', exception))
+ @rest.stub(:delete_rest).and_raise(Net::HTTPServerException.new('403 "Forbidden"', exception))
@knife.ui.should_receive(:error)
lambda { @knife.run }.should raise_error(SystemExit)
end
diff --git a/spec/unit/knife/cookbook_test_spec.rb b/spec/unit/knife/cookbook_test_spec.rb
index 24c658dc6c..0e261c02a4 100644
--- a/spec/unit/knife/cookbook_test_spec.rb
+++ b/spec/unit/knife/cookbook_test_spec.rb
@@ -26,25 +26,25 @@ describe Chef::Knife::CookbookTest do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::CookbookTest.new
@knife.config[:cookbook_path] = File.join(CHEF_SPEC_DATA,'cookbooks')
- @knife.cookbook_loader.stub!(:cookbook_exists?).and_return(true)
+ @knife.cookbook_loader.stub(:cookbook_exists?).and_return(true)
@cookbooks = []
%w{tats central_market jimmy_johns pho}.each do |cookbook_name|
@cookbooks << Chef::CookbookVersion.new(cookbook_name)
end
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
it "should test the cookbook" do
- @knife.stub!(:test_cookbook).and_return(true)
+ @knife.stub(:test_cookbook).and_return(true)
@knife.name_args = ["italian"]
@knife.should_receive(:test_cookbook).with("italian")
@knife.run
end
it "should test multiple cookbooks when provided" do
- @knife.stub!(:test_cookbook).and_return(true)
+ @knife.stub(:test_cookbook).and_return(true)
@knife.name_args = ["tats", "jimmy_johns"]
@knife.should_receive(:test_cookbook).with("tats")
@knife.should_receive(:test_cookbook).with("jimmy_johns")
@@ -65,14 +65,14 @@ describe Chef::Knife::CookbookTest do
describe "with -a or --all" do
it "should test all of the cookbooks" do
- @knife.stub!(:test_cookbook).and_return(true)
+ @knife.stub(:test_cookbook).and_return(true)
@knife.config[:all] = true
@loader = {}
- @loader.stub!(:load_cookbooks).and_return(@loader)
+ @loader.stub(:load_cookbooks).and_return(@loader)
@cookbooks.each do |cookbook|
@loader[cookbook.name] = cookbook
end
- @knife.stub!(:cookbook_loader).and_return(@loader)
+ @knife.stub(:cookbook_loader).and_return(@loader)
@loader.each do |key, cookbook|
@knife.should_receive(:test_cookbook).with(cookbook.name)
end
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index 5572430b50..e1fa5c975a 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -30,14 +30,14 @@ describe Chef::Knife::CookbookUpload do
@cookbook = Chef::CookbookVersion.new('test_cookbook')
@cookbook_loader = {}
- @cookbook_loader.stub!(:[]).and_return(@cookbook)
- @cookbook_loader.stub!(:merged_cookbooks).and_return([])
- @cookbook_loader.stub!(:load_cookbooks).and_return(@cookbook_loader)
- Chef::CookbookLoader.stub!(:new).and_return(@cookbook_loader)
+ @cookbook_loader.stub(:[]).and_return(@cookbook)
+ @cookbook_loader.stub(:merged_cookbooks).and_return([])
+ @cookbook_loader.stub(:load_cookbooks).and_return(@cookbook_loader)
+ Chef::CookbookLoader.stub(:new).and_return(@cookbook_loader)
@output = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@output)
- @knife.ui.stub!(:stderr).and_return(@output)
+ @knife.ui.stub(:stdout).and_return(@output)
+ @knife.ui.stub(:stderr).and_return(@output)
end
describe 'with --concurrency' do
@@ -46,8 +46,8 @@ describe Chef::Knife::CookbookUpload do
Chef::CookbookVersion.stub(:list_all_versions).and_return({})
@knife.config[:concurrency] = 3
@test_cookbook = Chef::CookbookVersion.new('test_cookbook')
- @cookbook_loader.stub!(:each).and_yield("test_cookbook", @test_cookbook)
- @cookbook_loader.stub!(:cookbook_names).and_return(["test_cookbook"])
+ @cookbook_loader.stub(:each).and_yield("test_cookbook", @test_cookbook)
+ @cookbook_loader.stub(:cookbook_names).and_return(["test_cookbook"])
Chef::CookbookUploader.should_receive(:new).with( kind_of(Array), kind_of(Array),
{:force=>nil, :concurrency => 3}).and_return(double("Chef::CookbookUploader", :upload_cookbooks=> true))
@knife.run
@@ -98,9 +98,9 @@ describe Chef::Knife::CookbookUpload do
'test_cookbook3' => Chef::CookbookVersion.new('test_cookbook3')
}
@cookbook_loader = {}
- @cookbook_loader.stub!(:merged_cookbooks).and_return([])
+ @cookbook_loader.stub(:merged_cookbooks).and_return([])
@cookbook_loader.stub(:[]) { |ckbk| @cookbooks[ckbk] }
- Chef::CookbookLoader.stub!(:new).and_return(@cookbook_loader)
+ Chef::CookbookLoader.stub(:new).and_return(@cookbook_loader)
end
it "should read only one cookbook" do
@@ -130,12 +130,12 @@ describe Chef::Knife::CookbookUpload do
@test_cookbook2.metadata.depends("test_cookbook3")
@test_cookbook3.metadata.depends("test_cookbook1")
@test_cookbook3.metadata.depends("test_cookbook2")
- @cookbook_loader.stub!(:[]) do |ckbk|
+ @cookbook_loader.stub(:[]) do |ckbk|
{ "test_cookbook1" => @test_cookbook1,
"test_cookbook2" => @test_cookbook2,
"test_cookbook3" => @test_cookbook3 }[ckbk]
end
- @knife.stub!(:cookbook_names).and_return(["test_cookbook1", "test_cookbook2", "test_cookbook3"])
+ @knife.stub(:cookbook_names).and_return(["test_cookbook1", "test_cookbook2", "test_cookbook3"])
@knife.should_receive(:upload).exactly(3).times
Timeout::timeout(5) do
@knife.run
@@ -154,8 +154,8 @@ describe Chef::Knife::CookbookUpload do
@knife.config[:all] = true
@test_cookbook1 = Chef::CookbookVersion.new('test_cookbook1')
@test_cookbook2 = Chef::CookbookVersion.new('test_cookbook2')
- @cookbook_loader.stub!(:each).and_yield("test_cookbook1", @test_cookbook1).and_yield("test_cookbook2", @test_cookbook2)
- @cookbook_loader.stub!(:cookbook_names).and_return(["test_cookbook1", "test_cookbook2"])
+ @cookbook_loader.stub(:each).and_yield("test_cookbook1", @test_cookbook1).and_yield("test_cookbook2", @test_cookbook2)
+ @cookbook_loader.stub(:cookbook_names).and_return(["test_cookbook1", "test_cookbook2"])
end
it 'should upload all cookbooks' do
@@ -170,7 +170,7 @@ describe Chef::Knife::CookbookUpload do
end
it 'should update the version constraints for an environment' do
- @knife.stub!(:assert_environment_valid!).and_return(true)
+ @knife.stub(:assert_environment_valid!).and_return(true)
@knife.config[:environment] = "production"
@knife.should_receive(:update_version_constraints).once
@knife.run
@@ -188,9 +188,9 @@ describe Chef::Knife::CookbookUpload do
end
it 'should not update the version constraints for an environment' do
- @knife.stub!(:assert_environment_valid!).and_return(true)
+ @knife.stub(:assert_environment_valid!).and_return(true)
@knife.config[:environment] = "production"
- @knife.stub!(:upload).and_raise(Chef::Exceptions::CookbookFrozen)
+ @knife.stub(:upload).and_raise(Chef::Exceptions::CookbookFrozen)
@knife.ui.should_receive(:error).with(/Failed to upload 1 cookbook/)
@knife.ui.should_receive(:warn).with(/Not updating version constraints/)
@knife.should_not_receive(:update_version_constraints)
diff --git a/spec/unit/knife/core/cookbook_scm_repo_spec.rb b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
index 629164ad0a..69da5400b0 100644
--- a/spec/unit/knife/core/cookbook_scm_repo_spec.rb
+++ b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
@@ -54,17 +54,17 @@ BRANCHES
describe "and the repo dir exists" do
before do
- ::File.stub!(:directory?).with(@repo_path).and_return(true)
+ ::File.stub(:directory?).with(@repo_path).and_return(true)
end
it "exits when there is no git repo" do
- ::File.stub!(:directory?).with(/.*\.git/).and_return(false)
+ ::File.stub(:directory?).with(/.*\.git/).and_return(false)
lambda {@cookbook_repo.sanity_check}.should raise_error(SystemExit)
end
describe "and the repo is a git repo" do
before do
- ::File.stub!(:directory?).with(File.join(@repo_path, '.git')).and_return(true)
+ ::File.stub(:directory?).with(File.join(@repo_path, '.git')).and_return(true)
end
it "exits when the default branch doesn't exist" do
@@ -92,7 +92,7 @@ DIRTY
describe "and the repo is clean" do
before do
@clean_status = Mixlib::ShellOut.new.tap {|s| s.stdout.replace("\n")}
- @cookbook_repo.stub!(:shell_out!).with('git status --porcelain', :cwd => @repo_path).and_return(@clean_status)
+ @cookbook_repo.stub(:shell_out!).with('git status --porcelain', :cwd => @repo_path).and_return(@clean_status)
end
it "passes the sanity check" do
@@ -143,7 +143,7 @@ DIRTY
before do
@updates = Mixlib::ShellOut.new
@updates.stdout.replace("\n")
- @cookbook_repo.stub!(:shell_out!).with('git status --porcelain -- apache2', :cwd => @repo_path).and_return(@updates)
+ @cookbook_repo.stub(:shell_out!).with('git status --porcelain -- apache2', :cwd => @repo_path).and_return(@updates)
end
it "shows no changes in the pristine copy" do
@@ -159,7 +159,7 @@ DIRTY
before do
@updates = Mixlib::ShellOut.new
@updates.stdout.replace(" M cookbooks/apache2/recipes/default.rb\n")
- @cookbook_repo.stub!(:shell_out!).with('git status --porcelain -- apache2', :cwd => @repo_path).and_return(@updates)
+ @cookbook_repo.stub(:shell_out!).with('git status --porcelain -- apache2', :cwd => @repo_path).and_return(@updates)
end
it "shows changes in the pristine copy" do
diff --git a/spec/unit/knife/core/object_loader_spec.rb b/spec/unit/knife/core/object_loader_spec.rb
index b3456e2b15..53a538da91 100644
--- a/spec/unit/knife/core/object_loader_spec.rb
+++ b/spec/unit/knife/core/object_loader_spec.rb
@@ -24,7 +24,7 @@ describe Chef::Knife::Core::ObjectLoader do
before(:each) do
@knife = Chef::Knife.new
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
Dir.chdir(File.join(CHEF_SPEC_DATA, 'object_loader'))
end
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 18e88b6cde..f550b82835 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -412,28 +412,28 @@ EOM
@question = "monkeys rule"
@stdout = StringIO.new
@ui.stub(:stdout).and_return(@stdout)
- @ui.stdin.stub!(:readline).and_return("y")
+ @ui.stdin.stub(:readline).and_return("y")
end
it "should return true if you answer Y" do
- @ui.stdin.stub!(:readline).and_return("Y")
+ @ui.stdin.stub(:readline).and_return("Y")
@ui.confirm(@question).should == true
end
it "should return true if you answer y" do
- @ui.stdin.stub!(:readline).and_return("y")
+ @ui.stdin.stub(:readline).and_return("y")
@ui.confirm(@question).should == true
end
it "should exit 3 if you answer N" do
- @ui.stdin.stub!(:readline).and_return("N")
+ @ui.stdin.stub(:readline).and_return("N")
lambda {
@ui.confirm(@question)
}.should raise_error(SystemExit) { |e| e.status.should == 3 }
end
it "should exit 3 if you answer n" do
- @ui.stdin.stub!(:readline).and_return("n")
+ @ui.stdin.stub(:readline).and_return("n")
lambda {
@ui.confirm(@question)
}.should raise_error(SystemExit) { |e| e.status.should == 3 }
@@ -449,16 +449,16 @@ EOM
describe "when asking for free-form user input" do
it "asks a question and returns the answer provided by the user" do
out = StringIO.new
- @ui.stub!(:stdout).and_return(out)
- @ui.stub!(:stdin).and_return(StringIO.new("http://mychefserver.example.com\n"))
+ @ui.stub(:stdout).and_return(out)
+ @ui.stub(:stdin).and_return(StringIO.new("http://mychefserver.example.com\n"))
@ui.ask_question("your chef server URL?").should == "http://mychefserver.example.com"
out.string.should == "your chef server URL?"
end
it "suggests a default setting and returns the default when the user's response only contains whitespace" do
out = StringIO.new
- @ui.stub!(:stdout).and_return(out)
- @ui.stub!(:stdin).and_return(StringIO.new(" \n"))
+ @ui.stub(:stdout).and_return(out)
+ @ui.stub(:stdin).and_return(StringIO.new(" \n"))
@ui.ask_question("your chef server URL? ", :default => 'http://localhost:4000').should == "http://localhost:4000"
out.string.should == "your chef server URL? [http://localhost:4000] "
end
diff --git a/spec/unit/knife/data_bag_create_spec.rb b/spec/unit/knife/data_bag_create_spec.rb
index b2f24bbb39..984be8e58a 100644
--- a/spec/unit/knife/data_bag_create_spec.rb
+++ b/spec/unit/knife/data_bag_create_spec.rb
@@ -39,9 +39,9 @@ describe Chef::Knife::DataBagCreate do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::DataBagCreate.new
@rest = ChefSpecs::ChefRest.new
- @knife.stub!(:rest).and_return(@rest)
+ @knife.stub(:rest).and_return(@rest)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
@@ -101,7 +101,7 @@ describe Chef::Knife::DataBagCreate do
end
it "creates an encrypted data bag item via --secret" do
- @knife.stub!(:config).and_return({:secret => @secret})
+ @knife.stub(:config).and_return({:secret => @secret})
@knife.run
end
@@ -109,7 +109,7 @@ describe Chef::Knife::DataBagCreate do
secret_file = Tempfile.new("encrypted_data_bag_secret_file_test")
secret_file.puts(@secret)
secret_file.flush
- @knife.stub!(:config).and_return({:secret_file => secret_file.path})
+ @knife.stub(:config).and_return({:secret_file => secret_file.path})
@knife.run
end
end
diff --git a/spec/unit/knife/data_bag_edit_spec.rb b/spec/unit/knife/data_bag_edit_spec.rb
index 412a237321..534bc18f5c 100644
--- a/spec/unit/knife/data_bag_edit_spec.rb
+++ b/spec/unit/knife/data_bag_edit_spec.rb
@@ -30,10 +30,10 @@ describe Chef::Knife::DataBagEdit do
@knife = Chef::Knife::DataBagEdit.new
@rest = mock('chef-rest-mock')
- @knife.stub!(:rest).and_return(@rest)
+ @knife.stub(:rest).and_return(@rest)
@stdout = StringIO.new
- @knife.stub!(:stdout).and_return(@stdout)
+ @knife.stub(:stdout).and_return(@stdout)
@log = Chef::Log
@knife.name_args = ['bag_name', 'item_name']
end
@@ -45,7 +45,7 @@ describe Chef::Knife::DataBagEdit do
end
it "saves edits on a data bag item" do
- Chef::DataBagItem.stub!(:load).with('bag_name', 'item_name').and_return(@plain_data)
+ Chef::DataBagItem.stub(:load).with('bag_name', 'item_name').and_return(@plain_data)
@knife.should_receive(:edit_data).with(@plain_data).and_return(@edited_data)
@rest.should_receive(:put_rest).with("data/bag_name/item_name", @edited_data).ordered
@knife.run
@@ -58,7 +58,7 @@ describe Chef::Knife::DataBagEdit do
@secret)
@enc_edited_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(@edited_data,
@secret)
- Chef::DataBagItem.stub!(:load).with('bag_name', 'item_name').and_return(@enc_data)
+ Chef::DataBagItem.stub(:load).with('bag_name', 'item_name').and_return(@enc_data)
# Random IV is used each time the data bag item is encrypted, so values
# will not be equal if we encrypt same value twice.
@@ -75,7 +75,7 @@ describe Chef::Knife::DataBagEdit do
end
it "decrypts and encrypts via --secret" do
- @knife.stub!(:config).and_return({:secret => @secret})
+ @knife.stub(:config).and_return({:secret => @secret})
@knife.should_receive(:edit_data).with(@plain_data).and_return(@edited_data)
@rest.should_receive(:put_rest).with("data/bag_name/item_name", @enc_edited_data).ordered
@@ -83,7 +83,7 @@ describe Chef::Knife::DataBagEdit do
end
it "decrypts and encrypts via --secret_file" do
- @knife.stub!(:config).and_return({:secret_file => @secret_file.path})
+ @knife.stub(:config).and_return({:secret_file => @secret_file.path})
@knife.should_receive(:edit_data).with(@plain_data).and_return(@edited_data)
@rest.should_receive(:put_rest).with("data/bag_name/item_name", @enc_edited_data).ordered
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index cef1babd0b..aa1c16d0f4 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -30,9 +30,9 @@ describe Chef::Knife::DataBagFromFile do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::DataBagFromFile.new
@rest = mock("Chef::REST")
- @knife.stub!(:rest).and_return(@rest)
+ @knife.stub(:rest).and_return(@rest)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
@tmp_dir = Dir.mktmpdir
@db_folder = File.join(@tmp_dir, 'data_bags', 'bag_name')
FileUtils.mkdir_p(@db_folder)
@@ -64,7 +64,7 @@ describe Chef::Knife::DataBagFromFile do
it "loads from a file and saves" do
@knife.loader.should_receive(:load_from).with("data_bags", 'bag_name', @db_file.path).and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save)
@knife.run
@@ -77,7 +77,7 @@ describe Chef::Knife::DataBagFromFile do
@knife.loader.should_receive(:load_from).with("data_bags", 'bag_name', @db_file.path).and_return(@plain_data)
@knife.loader.should_receive(:load_from).with("data_bags", 'bag_name', @db_file2.path).and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save).twice
@knife.run
@@ -91,7 +91,7 @@ describe Chef::Knife::DataBagFromFile do
@knife.loader.should_receive(:load_from).with("data_bags", 'bag_name', @db_file.path).and_return(@plain_data)
@knife.loader.should_receive(:load_from).with("data_bags", 'bag_name', @db_file2.path).and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save).twice
@knife.run
end
@@ -109,7 +109,7 @@ describe Chef::Knife::DataBagFromFile do
it "loads all data bags when -a or --all options is provided" do
@knife.name_args = []
- @knife.stub!(:config).and_return({:all => true})
+ @knife.stub(:config).and_return({:all => true})
@knife.loader.should_receive(:load_from).with("data_bags", "bag_name", File.basename(@db_file.path)).
and_return(@plain_data)
@knife.loader.should_receive(:load_from).with("data_bags", "bag_name", File.basename(@db_file2.path)).
@@ -117,18 +117,18 @@ describe Chef::Knife::DataBagFromFile do
@knife.loader.should_receive(:load_from).with("data_bags", "bag_name2", File.basename(@db_file3.path)).
and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save).exactly(3).times
@knife.run
end
it "loads all data bags items when -a or --all options is provided" do
@knife.name_args = ["bag_name2"]
- @knife.stub!(:config).and_return({:all => true})
+ @knife.stub(:config).and_return({:all => true})
@knife.loader.should_receive(:load_from).with("data_bags", "bag_name2", File.basename(@db_file3.path)).
and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save)
@knife.run
dbag.data_bag.should == 'bag_name2'
@@ -158,11 +158,11 @@ describe Chef::Knife::DataBagFromFile do
end
it "encrypts values when given --secret" do
- @knife.stub!(:config).and_return({:secret => @secret})
+ @knife.stub(:config).and_return({:secret => @secret})
@knife.loader.should_receive(:load_from).with("data_bags", "bag_name", @db_file.path).and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save)
@knife.run
dbag.data_bag.should == 'bag_name'
@@ -170,11 +170,11 @@ describe Chef::Knife::DataBagFromFile do
end
it "encrypts values when given --secret_file" do
- @knife.stub!(:config).and_return({:secret_file => @secret_file.path})
+ @knife.stub(:config).and_return({:secret_file => @secret_file.path})
- @knife.loader.stub!(:load_from).with("data_bags", 'bag_name', @db_file.path).and_return(@plain_data)
+ @knife.loader.stub(:load_from).with("data_bags", 'bag_name', @db_file.path).and_return(@plain_data)
dbag = Chef::DataBagItem.new
- Chef::DataBagItem.stub!(:new).and_return(dbag)
+ Chef::DataBagItem.stub(:new).and_return(dbag)
dbag.should_receive(:save)
@knife.run
dbag.data_bag.should == 'bag_name'
diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb
index d64b4f286d..669dfeb5cc 100644
--- a/spec/unit/knife/data_bag_show_spec.rb
+++ b/spec/unit/knife/data_bag_show_spec.rb
@@ -30,9 +30,9 @@ describe Chef::Knife::DataBagShow do
@knife = Chef::Knife::DataBagShow.new
@knife.config[:format] = 'json'
@rest = mock("Chef::REST")
- @knife.stub!(:rest).and_return(@rest)
+ @knife.stub(:rest).and_return(@rest)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
@@ -83,7 +83,7 @@ describe Chef::Knife::DataBagShow do
end
it "prints the decrypted contents of an item when given --secret" do
- @knife.stub!(:config).and_return({:secret => @secret})
+ @knife.stub(:config).and_return({:secret => @secret})
Chef::EncryptedDataBagItem.should_receive(:load).
with('bag_name', 'item_name', @secret).
and_return(Chef::EncryptedDataBagItem.new(@enc_data, @secret))
@@ -92,7 +92,7 @@ describe Chef::Knife::DataBagShow do
end
it "prints the decrypted contents of an item when given --secret_file" do
- @knife.stub!(:config).and_return({:secret_file => @secret_file.path})
+ @knife.stub(:config).and_return({:secret_file => @secret_file.path})
Chef::EncryptedDataBagItem.should_receive(:load).
with('bag_name', 'item_name', @secret).
and_return(Chef::EncryptedDataBagItem.new(@enc_data, @secret))
diff --git a/spec/unit/knife/environment_create_spec.rb b/spec/unit/knife/environment_create_spec.rb
index 36f6556682..81bf6731b7 100644
--- a/spec/unit/knife/environment_create_spec.rb
+++ b/spec/unit/knife/environment_create_spec.rb
@@ -21,16 +21,16 @@ require 'spec_helper'
describe Chef::Knife::EnvironmentCreate do
before(:each) do
@knife = Chef::Knife::EnvironmentCreate.new
- @knife.stub!(:msg).and_return true
- @knife.stub!(:output).and_return true
- @knife.stub!(:show_usage).and_return true
+ @knife.stub(:msg).and_return true
+ @knife.stub(:output).and_return true
+ @knife.stub(:show_usage).and_return true
@knife.name_args = [ "production" ]
@environment = Chef::Environment.new
- @environment.stub!(:save)
+ @environment.stub(:save)
- Chef::Environment.stub!(:new).and_return @environment
- @knife.stub!(:edit_data).and_return @environment
+ Chef::Environment.stub(:new).and_return @environment
+ @knife.stub(:edit_data).and_return @environment
end
describe "run" do
diff --git a/spec/unit/knife/environment_delete_spec.rb b/spec/unit/knife/environment_delete_spec.rb
index 219ae4a923..0f6b5f3272 100644
--- a/spec/unit/knife/environment_delete_spec.rb
+++ b/spec/unit/knife/environment_delete_spec.rb
@@ -21,17 +21,17 @@ require 'spec_helper'
describe Chef::Knife::EnvironmentDelete do
before(:each) do
@knife = Chef::Knife::EnvironmentDelete.new
- @knife.stub!(:msg).and_return true
- @knife.stub!(:output).and_return true
- @knife.stub!(:show_usage).and_return true
- @knife.stub!(:confirm).and_return true
+ @knife.stub(:msg).and_return true
+ @knife.stub(:output).and_return true
+ @knife.stub(:show_usage).and_return true
+ @knife.stub(:confirm).and_return true
@knife.name_args = [ "production" ]
@environment = Chef::Environment.new
@environment.name("production")
@environment.description("Please delete me")
- @environment.stub!(:destroy).and_return true
- Chef::Environment.stub!(:load).and_return @environment
+ @environment.stub(:destroy).and_return true
+ Chef::Environment.stub(:load).and_return @environment
end
it "should confirm that you want to delete" do
diff --git a/spec/unit/knife/environment_edit_spec.rb b/spec/unit/knife/environment_edit_spec.rb
index 91f9f5d0f0..a82ead0b6b 100644
--- a/spec/unit/knife/environment_edit_spec.rb
+++ b/spec/unit/knife/environment_edit_spec.rb
@@ -21,16 +21,16 @@ require 'spec_helper'
describe Chef::Knife::EnvironmentEdit do
before(:each) do
@knife = Chef::Knife::EnvironmentEdit.new
- @knife.ui.stub!(:msg).and_return true
- @knife.ui.stub!(:output).and_return true
- @knife.ui.stub!(:show_usage).and_return true
+ @knife.ui.stub(:msg).and_return true
+ @knife.ui.stub(:output).and_return true
+ @knife.ui.stub(:show_usage).and_return true
@knife.name_args = [ "production" ]
@environment = Chef::Environment.new
@environment.name("production")
@environment.description("Please edit me")
- @environment.stub!(:save).and_return true
- Chef::Environment.stub!(:load).and_return @environment
+ @environment.stub(:save).and_return true
+ Chef::Environment.stub(:load).and_return @environment
@knife.ui.stub(:edit_data).and_return @environment
end
diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb
index 7d028ae3b8..f208320c5d 100644
--- a/spec/unit/knife/environment_from_file_spec.rb
+++ b/spec/unit/knife/environment_from_file_spec.rb
@@ -25,15 +25,15 @@ describe Chef::Knife::EnvironmentFromFile do
before(:each) do
@knife = Chef::Knife::EnvironmentFromFile.new
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
@knife.name_args = [ "spec.rb" ]
@environment = Chef::Environment.new
@environment.name("spec")
@environment.description("runs the unit tests")
@environment.cookbook_versions({"apt" => "= 1.2.3"})
- @environment.stub!(:save).and_return true
- @knife.loader.stub!(:load_from).and_return @environment
+ @environment.stub(:save).and_return true
+ @knife.loader.stub(:load_from).and_return @environment
end
describe "run" do
@@ -47,7 +47,7 @@ describe Chef::Knife::EnvironmentFromFile do
before(:each) do
@env_apple = @environment.dup
@env_apple.name("apple")
- @knife.loader.stub!(:load_from).with("apple.rb").and_return @env_apple
+ @knife.loader.stub(:load_from).with("apple.rb").and_return @env_apple
end
it "loads multiple environments if given" do
@@ -57,10 +57,10 @@ describe Chef::Knife::EnvironmentFromFile do
end
it "loads all environments with -a" do
- File.stub!(:expand_path).with("./environments/*.{json,rb}").and_return("/tmp/environments")
- Dir.stub!(:glob).with("/tmp/environments").and_return(["spec.rb", "apple.rb"])
+ File.stub(:expand_path).with("./environments/*.{json,rb}").and_return("/tmp/environments")
+ Dir.stub(:glob).with("/tmp/environments").and_return(["spec.rb", "apple.rb"])
@knife.name_args = []
- @knife.stub!(:config).and_return({:all => true})
+ @knife.stub(:config).and_return({:all => true})
@environment.should_receive(:save).twice
@knife.run
end
diff --git a/spec/unit/knife/environment_list_spec.rb b/spec/unit/knife/environment_list_spec.rb
index 05a3ae748a..25d2714d23 100644
--- a/spec/unit/knife/environment_list_spec.rb
+++ b/spec/unit/knife/environment_list_spec.rb
@@ -21,16 +21,16 @@ require 'spec_helper'
describe Chef::Knife::EnvironmentList do
before(:each) do
@knife = Chef::Knife::EnvironmentList.new
- @knife.stub!(:msg).and_return true
- @knife.stub!(:output).and_return true
- @knife.stub!(:show_usage).and_return true
+ @knife.stub(:msg).and_return true
+ @knife.stub(:output).and_return true
+ @knife.stub(:show_usage).and_return true
@environments = {
"production" => "http://localhost:4000/environments/production",
"development" => "http://localhost:4000/environments/development",
"testing" => "http://localhost:4000/environments/testing"
}
- Chef::Environment.stub!(:list).and_return @environments
+ Chef::Environment.stub(:list).and_return @environments
end
it "should make an api call to list the environments" do
diff --git a/spec/unit/knife/environment_show_spec.rb b/spec/unit/knife/environment_show_spec.rb
index 1e1556f4c3..c7b0c21657 100644
--- a/spec/unit/knife/environment_show_spec.rb
+++ b/spec/unit/knife/environment_show_spec.rb
@@ -21,15 +21,15 @@ require 'spec_helper'
describe Chef::Knife::EnvironmentShow do
before(:each) do
@knife = Chef::Knife::EnvironmentShow.new
- @knife.stub!(:msg).and_return true
- @knife.stub!(:output).and_return true
- @knife.stub!(:show_usage).and_return true
+ @knife.stub(:msg).and_return true
+ @knife.stub(:output).and_return true
+ @knife.stub(:show_usage).and_return true
@knife.name_args = [ "production" ]
@environment = Chef::Environment.new
@environment.name("production")
@environment.description("Look at me!")
- Chef::Environment.stub!(:load).and_return @environment
+ Chef::Environment.stub(:load).and_return @environment
end
it "should load the environment" do
diff --git a/spec/unit/knife/index_rebuild_spec.rb b/spec/unit/knife/index_rebuild_spec.rb
index eb4e8020c8..251b525da1 100644
--- a/spec/unit/knife/index_rebuild_spec.rb
+++ b/spec/unit/knife/index_rebuild_spec.rb
@@ -29,7 +29,7 @@ describe Chef::Knife::IndexRebuild do
before :each do
# This keeps the test output clean
- knife.ui.stub!(:stdout).and_return(StringIO.new)
+ knife.ui.stub(:stdout).and_return(StringIO.new)
end
context "#grab_api_info" do
diff --git a/spec/unit/knife/knife_help.rb b/spec/unit/knife/knife_help.rb
index f5753e3d62..e66a44801b 100644
--- a/spec/unit/knife/knife_help.rb
+++ b/spec/unit/knife/knife_help.rb
@@ -37,10 +37,10 @@ describe Chef::Knife::Help do
it "should suggest topics" do
@knife.name_args = [ "list" ]
- @knife.ui.stub!(:msg)
+ @knife.ui.stub(:msg)
@knife.ui.should_receive(:info).with("Available help topics are: ")
@knife.ui.should_receive(:msg).with(/knife/)
- @knife.stub!(:exec)
+ @knife.stub(:exec)
@knife.should_receive(:exit).with(1)
@knife.run
end
@@ -57,9 +57,9 @@ describe Chef::Knife::Help do
describe "find_manpages_for_query" do
it "should error if it does not find a match" do
- @knife.ui.stub!(:error)
- @knife.ui.stub!(:info)
- @knife.ui.stub!(:msg)
+ @knife.ui.stub(:error)
+ @knife.ui.stub(:info)
+ @knife.ui.stub(:msg)
@knife.should_receive(:exit).with(1)
@knife.ui.should_receive(:error).with("No help found for 'chickens'")
@knife.ui.should_receive(:msg).with(/knife/)
@@ -69,22 +69,22 @@ describe Chef::Knife::Help do
describe "print_help_topics" do
it "should print the known help topics" do
- @knife.ui.stub!(:msg)
- @knife.ui.stub!(:info)
+ @knife.ui.stub(:msg)
+ @knife.ui.stub(:info)
@knife.ui.should_receive(:msg).with(/knife/)
@knife.print_help_topics
end
it "should shorten topics prefixed by knife-" do
- @knife.ui.stub!(:msg)
- @knife.ui.stub!(:info)
+ @knife.ui.stub(:msg)
+ @knife.ui.stub(:info)
@knife.ui.should_receive(:msg).with(/node/)
@knife.print_help_topics
end
it "should not leave topics prefixed by knife-" do
- @knife.ui.stub!(:msg)
- @knife.ui.stub!(:info)
+ @knife.ui.stub(:msg)
+ @knife.ui.stub(:info)
@knife.ui.should_not_receive(:msg).with(/knife-node/)
@knife.print_help_topics
end
diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb
index 51f707dfcf..3faece5469 100644
--- a/spec/unit/knife/node_bulk_delete_spec.rb
+++ b/spec/unit/knife/node_bulk_delete_spec.rb
@@ -26,8 +26,8 @@ describe Chef::Knife::NodeBulkDelete do
@knife = Chef::Knife::NodeBulkDelete.new
@knife.name_args = ["."]
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:confirm).and_return(true)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:confirm).and_return(true)
@nodes = Hash.new
%w{adam brent jacob}.each do |node_name|
@nodes[node_name] = "http://localhost:4000/nodes/#{node_name}"
@@ -53,11 +53,11 @@ describe Chef::Knife::NodeBulkDelete do
@inflatedish_list = @nodes.keys.inject({}) do |nodes_by_name, name|
node = Chef::Node.new()
node.name(name)
- node.stub!(:destroy).and_return(true)
+ node.stub(:destroy).and_return(true)
nodes_by_name[name] = node
nodes_by_name
end
- @knife.stub!(:all_nodes).and_return(@inflatedish_list)
+ @knife.stub(:all_nodes).and_return(@inflatedish_list)
end
it "should print the nodes you are about to delete" do
diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb
index bc30ae7e83..04eca389c6 100644
--- a/spec/unit/knife/node_delete_spec.rb
+++ b/spec/unit/knife/node_delete_spec.rb
@@ -26,13 +26,13 @@ describe Chef::Knife::NodeDelete do
:print_after => nil
}
@knife.name_args = [ "adam" ]
- @knife.stub!(:output).and_return(true)
- @knife.stub!(:confirm).and_return(true)
+ @knife.stub(:output).and_return(true)
+ @knife.stub(:confirm).and_return(true)
@node = Chef::Node.new()
- @node.stub!(:destroy).and_return(true)
- Chef::Node.stub!(:load).and_return(@node)
+ @node.stub(:destroy).and_return(true)
+ Chef::Node.stub(:load).and_return(@node)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb
index 7fbd8192d1..27db3416f4 100644
--- a/spec/unit/knife/node_edit_spec.rb
+++ b/spec/unit/knife/node_edit_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Knife::NodeEdit do
describe "after loading the node" do
before do
- @knife.stub!(:node).and_return(@node)
+ @knife.stub(:node).and_return(@node)
@node.automatic_attrs = {:go => :away}
@node.default_attrs = {:hide => :me}
@node.override_attrs = {:dont => :show}
@@ -94,7 +94,7 @@ describe Chef::Knife::NodeEdit do
describe "edit_node" do
before do
- @knife.stub!(:node).and_return(@node)
+ @knife.stub(:node).and_return(@node)
end
let(:subject) { @knife.node_editor.edit_node }
diff --git a/spec/unit/knife/node_from_file_spec.rb b/spec/unit/knife/node_from_file_spec.rb
index c6b9610d9e..56a2a08b68 100644
--- a/spec/unit/knife/node_from_file_spec.rb
+++ b/spec/unit/knife/node_from_file_spec.rb
@@ -28,13 +28,13 @@ describe Chef::Knife::NodeFromFile do
:print_after => nil
}
@knife.name_args = [ "adam.rb" ]
- @knife.stub!(:output).and_return(true)
- @knife.stub!(:confirm).and_return(true)
+ @knife.stub(:output).and_return(true)
+ @knife.stub(:confirm).and_return(true)
@node = Chef::Node.new()
- @node.stub!(:save)
- @knife.loader.stub!(:load_from).and_return(@node)
+ @node.stub(:save)
+ @knife.loader.stub(:load_from).and_return(@node)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb
index 3482eab87c..cad2d6482d 100644
--- a/spec/unit/knife/node_list_spec.rb
+++ b/spec/unit/knife/node_list_spec.rb
@@ -23,13 +23,13 @@ describe Chef::Knife::NodeList do
Chef::Config[:node_name] = "webmonkey.example.com"
Chef::Config[:environment] = nil # reset this value each time, as it is not reloaded
@knife = Chef::Knife::NodeList.new
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:output).and_return(true)
@list = {
"foo" => "http://example.com/foo",
"bar" => "http://example.com/foo"
}
- Chef::Node.stub!(:list).and_return(@list)
- Chef::Node.stub!(:list_by_environment).and_return(@list)
+ Chef::Node.stub(:list).and_return(@list)
+ Chef::Node.stub(:list_by_environment).and_return(@list)
end
describe "run" do
diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb
index 80e372c30a..61f2e6af4c 100644
--- a/spec/unit/knife/node_run_list_add_spec.rb
+++ b/spec/unit/knife/node_run_list_add_spec.rb
@@ -26,10 +26,10 @@ describe Chef::Knife::NodeRunListAdd do
:after => nil
}
@knife.name_args = [ "adam", "role[monkey]" ]
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:output).and_return(true)
@node = Chef::Node.new()
- @node.stub!(:save).and_return(true)
- Chef::Node.stub!(:load).and_return(@node)
+ @node.stub(:save).and_return(true)
+ Chef::Node.stub(:load).and_return(@node)
end
describe "run" do
diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb
index 90869e8baa..5a008a3e07 100644
--- a/spec/unit/knife/node_run_list_remove_spec.rb
+++ b/spec/unit/knife/node_run_list_remove_spec.rb
@@ -27,12 +27,12 @@ describe Chef::Knife::NodeRunListRemove do
@node = Chef::Node.new()
@node.name("knifetest-node")
@node.run_list << "role[monkey]"
- @node.stub!(:save).and_return(true)
+ @node.stub(:save).and_return(true)
- @knife.ui.stub!(:output).and_return(true)
- @knife.ui.stub!(:confirm).and_return(true)
+ @knife.ui.stub(:output).and_return(true)
+ @knife.ui.stub(:confirm).and_return(true)
- Chef::Node.stub!(:load).and_return(@node)
+ Chef::Node.stub(:load).and_return(@node)
end
describe "run" do
diff --git a/spec/unit/knife/node_run_list_set_spec.rb b/spec/unit/knife/node_run_list_set_spec.rb
index bc102695ee..02281f8385 100644
--- a/spec/unit/knife/node_run_list_set_spec.rb
+++ b/spec/unit/knife/node_run_list_set_spec.rb
@@ -24,10 +24,10 @@ describe Chef::Knife::NodeRunListSet do
@knife = Chef::Knife::NodeRunListSet.new
@knife.config = {}
@knife.name_args = [ "adam", "role[monkey]" ]
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:output).and_return(true)
@node = Chef::Node.new()
- @node.stub!(:save).and_return(true)
- Chef::Node.stub!(:load).and_return(@node)
+ @node.stub(:save).and_return(true)
+ Chef::Node.stub(:load).and_return(@node)
end
describe "run" do
@@ -117,8 +117,8 @@ describe Chef::Knife::NodeRunListSet do
@stdout = StringIO.new
@stderr = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stderr).and_return(@stderr)
end
it "should exit" do
diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb
index eb3593fea1..72a269278e 100644
--- a/spec/unit/knife/node_show_spec.rb
+++ b/spec/unit/knife/node_show_spec.rb
@@ -28,9 +28,9 @@ describe Chef::Knife::NodeShow do
:environment => nil
}
@knife.name_args = [ "adam" ]
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:output).and_return(true)
@node = Chef::Node.new()
- Chef::Node.stub!(:load).and_return(@node)
+ Chef::Node.stub(:load).and_return(@node)
end
describe "run" do
diff --git a/spec/unit/knife/role_bulk_delete_spec.rb b/spec/unit/knife/role_bulk_delete_spec.rb
index 0ee84f6455..eb1d3b4cff 100644
--- a/spec/unit/knife/role_bulk_delete_spec.rb
+++ b/spec/unit/knife/role_bulk_delete_spec.rb
@@ -27,16 +27,16 @@ describe Chef::Knife::RoleBulkDelete do
}
@knife.name_args = ["."]
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:confirm).and_return(true)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:confirm).and_return(true)
@roles = Hash.new
%w{dev staging production}.each do |role_name|
role = Chef::Role.new()
role.name(role_name)
- role.stub!(:destroy).and_return(true)
+ role.stub(:destroy).and_return(true)
@roles[role_name] = role
end
- Chef::Role.stub!(:list).and_return(@roles)
+ Chef::Role.stub(:list).and_return(@roles)
end
describe "run" do
diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb
index 39fed8fb68..a4d7392b68 100644
--- a/spec/unit/knife/role_create_spec.rb
+++ b/spec/unit/knife/role_create_spec.rb
@@ -26,13 +26,13 @@ describe Chef::Knife::RoleCreate do
:description => nil
}
@knife.name_args = [ "adam" ]
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:output).and_return(true)
@role = Chef::Role.new()
- @role.stub!(:save)
- Chef::Role.stub!(:new).and_return(@role)
- @knife.stub!(:edit_data).and_return(@role)
+ @role.stub(:save)
+ Chef::Role.stub(:new).and_return(@role)
+ @knife.stub(:edit_data).and_return(@role)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb
index 37b16de7df..0771446d49 100644
--- a/spec/unit/knife/role_delete_spec.rb
+++ b/spec/unit/knife/role_delete_spec.rb
@@ -26,13 +26,13 @@ describe Chef::Knife::RoleDelete do
:print_after => nil
}
@knife.name_args = [ "adam" ]
- @knife.stub!(:output).and_return(true)
- @knife.stub!(:confirm).and_return(true)
+ @knife.stub(:output).and_return(true)
+ @knife.stub(:confirm).and_return(true)
@role = Chef::Role.new()
- @role.stub!(:destroy).and_return(true)
- Chef::Role.stub!(:load).and_return(@role)
+ @role.stub(:destroy).and_return(true)
+ Chef::Role.stub(:load).and_return(@role)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/role_edit_spec.rb b/spec/unit/knife/role_edit_spec.rb
index 3a002f348c..f6d3b41d98 100644
--- a/spec/unit/knife/role_edit_spec.rb
+++ b/spec/unit/knife/role_edit_spec.rb
@@ -24,12 +24,12 @@ describe Chef::Knife::RoleEdit do
@knife = Chef::Knife::RoleEdit.new
@knife.config[:print_after] = nil
@knife.name_args = [ "adam" ]
- @knife.ui.stub!(:output).and_return(true)
+ @knife.ui.stub(:output).and_return(true)
@role = Chef::Role.new()
- @role.stub!(:save)
- Chef::Role.stub!(:load).and_return(@role)
- @knife.ui.stub!(:edit_data).and_return(@role)
- @knife.ui.stub!(:msg)
+ @role.stub(:save)
+ Chef::Role.stub(:load).and_return(@role)
+ @knife.ui.stub(:edit_data).and_return(@role)
+ @knife.ui.stub(:msg)
end
describe "run" do
diff --git a/spec/unit/knife/role_from_file_spec.rb b/spec/unit/knife/role_from_file_spec.rb
index 9b81bb14af..986414647c 100644
--- a/spec/unit/knife/role_from_file_spec.rb
+++ b/spec/unit/knife/role_from_file_spec.rb
@@ -28,13 +28,13 @@ describe Chef::Knife::RoleFromFile do
:print_after => nil
}
@knife.name_args = [ "adam.rb" ]
- @knife.stub!(:output).and_return(true)
- @knife.stub!(:confirm).and_return(true)
+ @knife.stub(:output).and_return(true)
+ @knife.stub(:confirm).and_return(true)
@role = Chef::Role.new()
- @role.stub!(:save)
- @knife.loader.stub!(:load_from).and_return(@role)
+ @role.stub(:save)
+ @knife.loader.stub(:load_from).and_return(@role)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb
index d0cd3b4413..ef9642c04c 100644
--- a/spec/unit/knife/role_list_spec.rb
+++ b/spec/unit/knife/role_list_spec.rb
@@ -22,12 +22,12 @@ describe Chef::Knife::RoleList do
before(:each) do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::RoleList.new
- @knife.stub!(:output).and_return(true)
+ @knife.stub(:output).and_return(true)
@list = {
"foo" => "http://example.com/foo",
"bar" => "http://example.com/foo"
}
- Chef::Role.stub!(:list).and_return(@list)
+ Chef::Role.stub(:list).and_return(@list)
end
describe "run" do
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 01dd742da0..eff7c9ba5b 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -45,8 +45,8 @@ describe Chef::Knife::Ssh do
end
def configure_query(node_array)
- @query.stub!(:search).and_return([node_array])
- Chef::Search::Query.stub!(:new).and_return(@query)
+ @query.stub(:search).and_return([node_array])
+ Chef::Search::Query.stub(:new).and_return(@query)
end
def self.should_return_specified_attributes
@@ -99,10 +99,10 @@ describe Chef::Knife::Ssh do
context "when there are some hosts found but they do not have an attribute to connect with" do
before do
- @query.stub!(:search).and_return([[@node_foo, @node_bar]])
+ @query.stub(:search).and_return([[@node_foo, @node_bar]])
@node_foo.automatic_attrs[:fqdn] = nil
@node_bar.automatic_attrs[:fqdn] = nil
- Chef::Search::Query.stub!(:new).and_return(@query)
+ Chef::Search::Query.stub(:new).and_return(@query)
end
it "should raise a specific error (CHEF-3402)" do
@@ -175,7 +175,7 @@ describe Chef::Knife::Ssh do
before :each do
@knife.instance_variable_set(:@longest, 0)
ssh_config = {:timeout => 50, :user => "locutus", :port => 23 }
- Net::SSH.stub!(:configuration_for).with('the.b.org').and_return(ssh_config)
+ Net::SSH.stub(:configuration_for).with('the.b.org').and_return(ssh_config)
end
it "uses the port from an ssh config file" do
@@ -257,7 +257,7 @@ describe Chef::Knife::Ssh do
before do
@query = Chef::Search::Query.new
@query.should_receive(:search).and_return([[@node_foo]])
- Chef::Search::Query.stub!(:new).and_return(@query)
+ Chef::Search::Query.stub(:new).and_return(@query)
@knife.stub(:ssh_command).and_return(exit_code)
@knife.name_args = ['*:*', 'false']
end
diff --git a/spec/unit/knife/status_spec.rb b/spec/unit/knife/status_spec.rb
index b009997ab1..680868d53c 100644
--- a/spec/unit/knife/status_spec.rb
+++ b/spec/unit/knife/status_spec.rb
@@ -26,11 +26,11 @@ describe Chef::Knife::Status do
n.automatic_attrs["ohai_time"] = 1343845969
end
query = mock("Chef::Search::Query")
- query.stub!(:search).and_yield(node)
- Chef::Search::Query.stub!(:new).and_return(query)
+ query.stub(:search).and_yield(node)
+ Chef::Search::Query.stub(:new).and_return(query)
@knife = Chef::Knife::Status.new
@stdout = StringIO.new
- @knife.stub!(:highline).and_return(HighLine.new(StringIO.new, @stdout))
+ @knife.stub(:highline).and_return(HighLine.new(StringIO.new, @stdout))
end
describe "run" do
diff --git a/spec/unit/knife/tag_create_spec.rb b/spec/unit/knife/tag_create_spec.rb
index 925d060879..82e3ad68cd 100644
--- a/spec/unit/knife/tag_create_spec.rb
+++ b/spec/unit/knife/tag_create_spec.rb
@@ -7,10 +7,10 @@ describe Chef::Knife::TagCreate do
@knife.name_args = [ Chef::Config[:node_name], "happytag" ]
@node = Chef::Node.new
- @node.stub! :save
- Chef::Node.stub!(:load).and_return @node
+ @node.stub :save
+ Chef::Node.stub(:load).and_return @node
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/tag_delete_spec.rb b/spec/unit/knife/tag_delete_spec.rb
index ca279033a4..67e3dd3ff0 100644
--- a/spec/unit/knife/tag_delete_spec.rb
+++ b/spec/unit/knife/tag_delete_spec.rb
@@ -7,11 +7,11 @@ describe Chef::Knife::TagDelete do
@knife.name_args = [ Chef::Config[:node_name], "sadtag" ]
@node = Chef::Node.new
- @node.stub! :save
+ @node.stub :save
@node.tags << "sadtag" << "happytag"
- Chef::Node.stub!(:load).and_return @node
+ Chef::Node.stub(:load).and_return @node
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
describe "run" do
diff --git a/spec/unit/knife/tag_list_spec.rb b/spec/unit/knife/tag_list_spec.rb
index 0de5d5ebd8..3724a5c0b7 100644
--- a/spec/unit/knife/tag_list_spec.rb
+++ b/spec/unit/knife/tag_list_spec.rb
@@ -7,9 +7,9 @@ describe Chef::Knife::TagList do
@knife.name_args = [ Chef::Config[:node_name], "sadtag" ]
@node = Chef::Node.new
- @node.stub! :save
+ @node.stub :save
@node.tags << "sadtag" << "happytag"
- Chef::Node.stub!(:load).and_return @node
+ Chef::Node.stub(:load).and_return @node
end
describe "run" do
diff --git a/spec/unit/knife/user_create_spec.rb b/spec/unit/knife/user_create_spec.rb
index 0e36e148ac..00a570e4c8 100644
--- a/spec/unit/knife/user_create_spec.rb
+++ b/spec/unit/knife/user_create_spec.rb
@@ -30,14 +30,14 @@ describe Chef::Knife::UserCreate do
@user_with_private_key = Chef::User.new
@user_with_private_key.name "a_user"
@user_with_private_key.private_key 'private_key'
- @user.stub!(:create).and_return(@user_with_private_key)
- Chef::User.stub!(:new).and_return(@user)
- Chef::User.stub!(:from_hash).and_return(@user)
- @knife.stub!(:edit_data).and_return(@user.to_hash)
+ @user.stub(:create).and_return(@user_with_private_key)
+ Chef::User.stub(:new).and_return(@user)
+ Chef::User.stub(:from_hash).and_return(@user)
+ @knife.stub(:edit_data).and_return(@user.to_hash)
@stdout = StringIO.new
@stderr = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
- @knife.ui.stub!(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stderr).and_return(@stderr)
end
it "creates a new user" do
diff --git a/spec/unit/knife/user_reregister_spec.rb b/spec/unit/knife/user_reregister_spec.rb
index fddab57467..16d57042f0 100644
--- a/spec/unit/knife/user_reregister_spec.rb
+++ b/spec/unit/knife/user_reregister_spec.rb
@@ -24,9 +24,9 @@ describe Chef::Knife::UserReregister do
@knife = Chef::Knife::UserReregister.new
@knife.name_args = [ 'a_user' ]
@user_mock = mock('user_mock', :private_key => "private_key")
- Chef::User.stub!(:load).and_return(@user_mock)
+ Chef::User.stub(:load).and_return(@user_mock)
@stdout = StringIO.new
- @knife.ui.stub!(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stdout).and_return(@stdout)
end
it 'prints usage and exits when a user name is not provided' do