summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-09-16 21:58:45 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-16 21:58:45 -0700
commitc5012d8258dbd555b8691c5af34155b9308b8769 (patch)
treeb5f58b349860036f144e6e5b6757c9b353afd695
parent2d13566644515193d84f32ac0f67f073ebf58587 (diff)
downloadchef-c5012d8258dbd555b8691c5af34155b9308b8769.tar.gz
Don't bother cleaning up Chef::Config after tests or initializing things to default values before
-rw-r--r--spec/support/shared/functional/file_resource.rb24
-rw-r--r--spec/unit/application/apply.rb8
-rw-r--r--spec/unit/application/client_spec.rb4
-rw-r--r--spec/unit/application/solo_spec.rb10
-rw-r--r--spec/unit/application_spec.rb6
-rw-r--r--spec/unit/client_spec.rb18
-rw-r--r--spec/unit/config_spec.rb4
-rw-r--r--spec/unit/daemon_spec.rb14
-rw-r--r--spec/unit/knife/configure_spec.rb6
-rw-r--r--spec/unit/mixin/securable_spec.rb1
-rw-r--r--spec/unit/provider/file/content_spec.rb8
-rw-r--r--spec/unit/util/backup_spec.rb7
12 files changed, 0 insertions, 110 deletions
diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb
index 2f49966db0..c2876f5b2a 100644
--- a/spec/support/shared/functional/file_resource.rb
+++ b/spec/support/shared/functional/file_resource.rb
@@ -21,12 +21,6 @@ shared_context "deploying with move" do
Chef::Config[:file_backup_path] = CHEF_SPEC_BACKUP_PATH
Chef::Config[:file_atomic_update] = true
end
-
- after do
- Chef::Config.delete(:file_staging_uses_destdir)
- Chef::Config.delete(:file_backup_path)
- Chef::Config.delete(:file_atomic_update)
- end
end
shared_context "deploying with copy" do
@@ -34,12 +28,6 @@ shared_context "deploying with copy" do
Chef::Config[:file_backup_path] = CHEF_SPEC_BACKUP_PATH
Chef::Config[:file_atomic_update] = false
end
-
- after do
- Chef::Config.delete(:file_staging_uses_destdir)
- Chef::Config.delete(:file_backup_path)
- Chef::Config.delete(:file_atomic_update)
- end
end
shared_context "deploying via tmpdir" do
@@ -47,12 +35,6 @@ shared_context "deploying via tmpdir" do
Chef::Config[:file_staging_uses_destdir] = false
Chef::Config[:file_backup_path] = CHEF_SPEC_BACKUP_PATH
end
-
- after do
- Chef::Config.delete(:file_staging_uses_destdir)
- Chef::Config.delete(:file_backup_path)
- Chef::Config.delete(:file_atomic_update)
- end
end
shared_context "deploying via destdir" do
@@ -60,12 +42,6 @@ shared_context "deploying via destdir" do
Chef::Config[:file_staging_uses_destdir] = true
Chef::Config[:file_backup_path] = CHEF_SPEC_BACKUP_PATH
end
-
- after do
- Chef::Config.delete(:file_staging_uses_destdir)
- Chef::Config.delete(:file_backup_path)
- Chef::Config.delete(:file_atomic_update)
- end
end
diff --git a/spec/unit/application/apply.rb b/spec/unit/application/apply.rb
index 7038801a60..8a00413225 100644
--- a/spec/unit/application/apply.rb
+++ b/spec/unit/application/apply.rb
@@ -20,20 +20,12 @@ require 'spec_helper'
describe Chef::Application::Apply do
before do
- @original_config = Chef::Config.configuration
@app = Chef::Application::Recipe.new
@app.stub!(:configure_logging).and_return(true)
@recipe_text = "package 'nyancat'"
Chef::Config[:solo] = true
end
- after do
- Chef::Config[:solo] = nil
- Chef::Config.configuration.replace(@original_config)
- Chef::Config[:solo] = false
- end
-
-
describe "configuring the application" do
it "should set solo mode to true" do
@app.reconfigure
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index 45893119e2..ee0c958b96 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -21,21 +21,17 @@ describe Chef::Application::Client, "reconfigure" do
before do
@original_argv = ARGV.dup
ARGV.clear
- @original_config = Chef::Config.configuration.dup
@app = Chef::Application::Client.new
@app.stub!(:configure_opt_parser).and_return(true)
@app.stub!(:configure_chef).and_return(true)
@app.stub!(:configure_logging).and_return(true)
- Chef::Config[:json_attribs] = nil
Chef::Config[:interval] = 10
- Chef::Config[:splay] = nil
Chef::Config[:once] = false
end
after do
- Chef::Config.configuration.replace(@original_config)
ARGV.replace(@original_argv)
end
diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb
index 07598dd01c..b7d66463c8 100644
--- a/spec/unit/application/solo_spec.rb
+++ b/spec/unit/application/solo_spec.rb
@@ -19,25 +19,15 @@ require 'spec_helper'
describe Chef::Application::Solo do
before do
- @original_config = Chef::Config.configuration
-
-
@app = Chef::Application::Solo.new
@app.stub!(:configure_opt_parser).and_return(true)
@app.stub!(:configure_chef).and_return(true)
@app.stub!(:configure_logging).and_return(true)
Chef::Config[:recipe_url] = false
Chef::Config[:json_attribs] = false
- Chef::Config[:splay] = nil
Chef::Config[:solo] = true
end
- after do
- Chef::Config[:solo] = nil
- Chef::Config.configuration.replace(@original_config)
- Chef::Config[:solo] = false
- end
-
describe "configuring the application" do
it "should set solo mode to true" do
@app.reconfigure
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index 73139b667a..ec7f236f1f 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -22,7 +22,6 @@ describe Chef::Application do
before do
@original_argv = ARGV.dup
ARGV.clear
- @original_conf = Chef::Config.configuration
Chef::Log.logger = Logger.new(StringIO.new)
@app = Chef::Application.new
Dir.stub!(:chdir).and_return(0)
@@ -30,7 +29,6 @@ describe Chef::Application do
end
after do
- Chef::Config.configuration.replace(@original_conf)
ARGV.replace(@original_argv)
end
@@ -98,8 +96,6 @@ describe Chef::Application do
describe "when a config_file is present" do
before do
- Chef::Config.configuration.delete('rspec_ran')
-
@config_file = Tempfile.new("rspec-chef-config")
@config_file.puts("rspec_ran('true')")
@config_file.close
@@ -149,8 +145,6 @@ describe Chef::Application do
describe "when the config_file is an URL" do
before do
- Chef::Config.configuration.delete('rspec_ran')
-
@app.config[:config_file] = "http://example.com/foo.rb"
@config_file = Tempfile.new("rspec-chef-config")
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 6f0c2b9da5..1b7a292f18 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -74,23 +74,13 @@ shared_examples_for Chef::Client do
end
describe "configuring output formatters" do
- before do
- @original_config = Chef::Config.configuration
- end
-
- after do
- Chef::Config.configuration.replace(@original_config)
- end
context "when no formatter has been configured" do
before do
- Chef::Config.formatters.clear
@client = Chef::Client.new
end
context "and STDOUT is a TTY" do
before do
- Chef::Config[:force_formatter] = false
- Chef::Config[:force_logger] = false
STDOUT.stub!(:tty?).and_return(true)
end
@@ -114,7 +104,6 @@ shared_examples_for Chef::Client do
context "and STDOUT is not a TTY" do
before do
- Chef::Config[:force_formatter] = false
STDOUT.stub!(:tty?).and_return(false)
end
@@ -137,7 +126,6 @@ shared_examples_for Chef::Client do
context "when a formatter is configured" do
context "with no output path" do
before do
- Chef::Config.formatters.clear
@client = Chef::Client.new
Chef::Config.add_formatter(:min)
end
@@ -156,7 +144,6 @@ shared_examples_for Chef::Client do
context "with an output path" do
before do
- Chef::Config.formatters.clear
@client = Chef::Client.new
@tmpout = Tempfile.open("rspec-for-client-formatter-selection-#{Process.pid}")
Chef::Config.add_formatter(:min, @tmpout.path)
@@ -468,14 +455,9 @@ end
describe "Chef::Client Forked" do
before do
- @original_config = Chef::Config.configuration
Chef::Config[:client_fork] = true
end
- after do
- Chef::Config.configuration.replace(@original_config)
- end
-
it_behaves_like Chef::Client
end
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index b4052f4908..3434e66b76 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -137,10 +137,6 @@ describe Chef::Config do
and_return(@mockfile)
end
- after do
- Chef::Config.log_location = STDOUT
- end
-
it "should configure itself to use a File object based upon the String" do
Chef::Config.log_location = "/var/log/chef/client.log"
Chef::Config.log_location.path.should == "/var/log/chef/client.log"
diff --git a/spec/unit/daemon_spec.rb b/spec/unit/daemon_spec.rb
index 5c0d828354..5cc32d0e40 100644
--- a/spec/unit/daemon_spec.rb
+++ b/spec/unit/daemon_spec.rb
@@ -20,7 +20,6 @@ require 'ostruct'
describe Chef::Daemon do
before do
- @original_config = Chef::Config.configuration
if windows?
mock_struct = #Struct::Passwd.new(nil, nil, 111, 111)
mock_struct = OpenStruct.new(:uid => 2342, :gid => 2342)
@@ -33,10 +32,6 @@ describe Chef::Daemon do
end
end
- after do
- Chef::Config.configuration.replace(@original_config)
- end
-
describe ".running?" do
before do
@@ -77,10 +72,6 @@ describe Chef::Daemon do
Chef::Config[:pid_file] = "/var/run/chef/chef-client.pid"
end
- after do
- Chef::Config.configuration.replace(@original_config)
- end
-
it "should return the supplied value" do
Chef::Daemon.pid_file.should eql("/var/run/chef/chef-client.pid")
end
@@ -89,7 +80,6 @@ describe Chef::Daemon do
describe "without the pid_file option set" do
before do
- Chef::Config[:pid_file] = nil
Chef::Daemon.name = "chef-client"
end
@@ -230,10 +220,6 @@ describe Chef::Daemon do
end
describe "when just the user option is supplied" do
- before do
- Chef::Config[:group] = nil
- end
-
it "should log an appropriate info message" do
Chef::Log.should_receive(:info).with("About to change privilege to aj")
Chef::Daemon.change_privilege
diff --git a/spec/unit/knife/configure_spec.rb b/spec/unit/knife/configure_spec.rb
index 3fe4f86eb9..7c48be6727 100644
--- a/spec/unit/knife/configure_spec.rb
+++ b/spec/unit/knife/configure_spec.rb
@@ -4,8 +4,6 @@ describe Chef::Knife::Configure do
before do
Chef::Log.logger = Logger.new(StringIO.new)
- @original_config = Chef::Config.configuration.dup
-
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::Configure.new
@rest_client = mock("null rest client", :post_rest => { :result => :true })
@@ -24,10 +22,6 @@ describe Chef::Knife::Configure do
Ohai::System.stub!(:new).and_return(ohai)
end
- after do
- Chef::Config.configuration.replace(@original_config)
- end
-
let(:fqdn) { "foo.example.org" }
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 3b972084a4..fe21393c90 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -104,7 +104,6 @@ describe Chef::Mixin::Securable do
describe "windows-specific behavior" do
before(:each) do
platform_mock :windows do
- @original_config = Chef::Config.hash_dup
load File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "chef", "config.rb")
load File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "chef", "mixin", "securable.rb")
SECURABLE_CLASS = Class.new do
diff --git a/spec/unit/provider/file/content_spec.rb b/spec/unit/provider/file/content_spec.rb
index 693877760e..9262a35245 100644
--- a/spec/unit/provider/file/content_spec.rb
+++ b/spec/unit/provider/file/content_spec.rb
@@ -20,14 +20,6 @@ require 'spec_helper'
describe Chef::Provider::File::Content do
- before(:all) do
- @original_config = Chef::Config.configuration
- end
-
- after(:all) do
- Chef::Config.configuration.replace(@original_config)
- end
-
#
# mock setup
#
diff --git a/spec/unit/util/backup_spec.rb b/spec/unit/util/backup_spec.rb
index f0e182e181..cbb91e6c04 100644
--- a/spec/unit/util/backup_spec.rb
+++ b/spec/unit/util/backup_spec.rb
@@ -21,13 +21,6 @@ require 'spec_helper'
require 'tmpdir'
describe Chef::Util::Backup do
- before(:all) do
- @original_config = Chef::Config.configuration
- end
-
- after(:all) do
- Chef::Config.configuration.replace(@original_config)
- end
let (:tempfile) do
Tempfile.new("chef-util-backup-spec-test")