diff options
author | John Keiser <jkeiser@opscode.com> | 2013-09-16 16:22:10 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-09-16 16:22:10 -0700 |
commit | b1a0be6178933a574ded85dfb57120929e582f66 (patch) | |
tree | 4c081caef46157940e6b983c394f4d0d382d25ee /spec | |
parent | 22082616751b585fbaeaba1bdd541b6a1f3a5a51 (diff) | |
download | chef-b1a0be6178933a574ded85dfb57120929e582f66.tar.gz |
Fix tests that rely on leaky Chef::Config
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/knife/ssh_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/application_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/knife/cookbook_create_spec.rb | 13 | ||||
-rw-r--r-- | spec/unit/knife/ssh_spec.rb | 2 |
4 files changed, 6 insertions, 16 deletions
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb index 4cc588d01e..fd8cfe0f7e 100644 --- a/spec/functional/knife/ssh_spec.rb +++ b/spec/functional/knife/ssh_spec.rb @@ -149,9 +149,9 @@ describe Chef::Knife::Ssh do Chef::Config[:knife][:ssh_user] = nil end - it "uses the default" do + it "uses the default (current user)" do @knife.run - @knife.config[:ssh_user].should == "root" + @knife.config[:ssh_user].should == nil end end end diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index e0701614a3..73139b667a 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -193,7 +193,8 @@ describe Chef::Application do end it "should initialise the chef logger level" do - Chef::Log.should_receive(:level=).with(Chef::Config[:log_level]).and_return(true) + # By default, Chef translates :auto to :warn + Chef::Log.should_receive(:level=).with(:warn).and_return(true) @app.configure_logging end diff --git a/spec/unit/knife/cookbook_create_spec.rb b/spec/unit/knife/cookbook_create_spec.rb index dc1d7d7f79..7891115285 100644 --- a/spec/unit/knife/cookbook_create_spec.rb +++ b/spec/unit/knife/cookbook_create_spec.rb @@ -245,15 +245,8 @@ describe Chef::Knife::CookbookCreate do @knife.run end - it "should create a CHANGELOG file" do - @dir = Dir.tmpdir - @knife.should_receive(:create_changelog).with(@dir, @knife.name_args.first) - @knife.run - end - - context "when the cookbooks path is not specified in the config file nor supplied via parameter" do + context "when the cookbooks path is set to nil" do before do - @old_cookbook_path = Chef::Config[:cookbook_path] Chef::Config[:cookbook_path] = nil end @@ -261,10 +254,6 @@ describe Chef::Knife::CookbookCreate do @dir = Dir.tmpdir lambda{@knife.run}.should raise_error(ArgumentError) end - - after do - Chef::Config[:cookbook_path] = @old_cookbook_path - end end end diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb index 7e5c5ce88e..0d67f33ee7 100644 --- a/spec/unit/knife/ssh_spec.rb +++ b/spec/unit/knife/ssh_spec.rb @@ -21,7 +21,7 @@ require 'net/ssh' require 'net/ssh/multi' describe Chef::Knife::Ssh do - before(:all) do + before(:each) do Chef::Config[:client_key] = CHEF_SPEC_DATA + "/ssl/private_key.pem" end |