summaryrefslogtreecommitdiff
path: root/spec/unit/system_spec.rb
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-09-16 22:21:18 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-16 22:21:18 -0700
commita71ec74507ea8f8f5e39fe99e91cb22f6b3d5f00 (patch)
tree7afcd90f97de23e74d6c2725751efe82e0737daa /spec/unit/system_spec.rb
parent65d41edd4108622b836917580ab515b978c76562 (diff)
downloadohai-a71ec74507ea8f8f5e39fe99e91cb22f6b3d5f00.tar.gz
Use mixlib-config 2.0 and reset config before each test
Diffstat (limited to 'spec/unit/system_spec.rb')
-rw-r--r--spec/unit/system_spec.rb17
1 files changed, 1 insertions, 16 deletions
diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb
index b5e6a5bf..c29ca2b2 100644
--- a/spec/unit/system_spec.rb
+++ b/spec/unit/system_spec.rb
@@ -40,7 +40,6 @@ describe "Ohai::System" do
describe "#load_plugins" do
before(:each) do
- @plugin_path = Ohai::Config[:plugin_path]
Ohai::OS.stub(:collect_os).and_return("ubuntu")
loader = double('@loader')
@@ -52,10 +51,6 @@ describe "Ohai::System" do
loader.stub(:load_plugin).with("/tmp/plugins/empty.rb").and_return(plugin)
end
- after(:each) do
- Ohai::Config[:plugin_path] = @plugin_path
- end
-
it "should load plugins when plugin_path has a trailing slash" do
Ohai::Config[:plugin_path] = ["/tmp/plugins/"]
Dir.should_receive(:[]).with("/tmp/plugins/*").and_return(["/tmp/plugins/empty.rb"])
@@ -262,15 +257,10 @@ describe "Ohai::System" do
end
context "when a plugin is disabled" do
- before(:all) do
- @disabled_plugins = Ohai::Config[:disabled_plugins]
+ before(:each) do
Ohai::Config[:disabled_plugins] = ["empty"]
end
- after(:all) do
- Ohai::Config[:disabled_plugins] = @disabled_plugins
- end
-
it "should not run the plugin" do
Ohai::Log.should_receive(:debug).with(/Skipping disabled plugin/)
@ohai.should_not_receive(:plugin_for).with("empty")
@@ -392,7 +382,6 @@ EOF
describe "#plugin_for" do
before(:each) do
- @plugin_path = Ohai::Config[:plugin_path]
Ohai::Config[:plugin_path] = ["/tmp/plugins"]
@loader = double('@loader')
@@ -402,10 +391,6 @@ EOF
@klass = Ohai.v6plugin { }
end
- after(:each) do
- Ohai::Config[:plugin_path] = @plugin_path
- end
-
it "should find a plugin with a simple name" do
plugin = @klass.new(@ohai, "/tmp/plugins/empty.rb")
File.stub(:join).with("/tmp/plugins", "empty.rb").and_return("/tmp/plugins/empty.rb")