summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-09-16 16:22:10 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-16 16:22:10 -0700
commitb1a0be6178933a574ded85dfb57120929e582f66 (patch)
tree4c081caef46157940e6b983c394f4d0d382d25ee /spec/unit
parent22082616751b585fbaeaba1bdd541b6a1f3a5a51 (diff)
downloadchef-b1a0be6178933a574ded85dfb57120929e582f66.tar.gz
Fix tests that rely on leaky Chef::Config
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/application_spec.rb3
-rw-r--r--spec/unit/knife/cookbook_create_spec.rb13
-rw-r--r--spec/unit/knife/ssh_spec.rb2
3 files changed, 4 insertions, 14 deletions
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