From 02203d52d8cb23652fff9afbcb5d5b10fdb114a5 Mon Sep 17 00:00:00 2001 From: sersut Date: Tue, 14 Jan 2014 17:03:22 -0800 Subject: Convert @ohai => let(:ohai) in system_spec. --- spec/unit/system_spec.rb | 142 +++++++++++++++++++++-------------------------- 1 file changed, 64 insertions(+), 78 deletions(-) diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb index e56d00c5..ff5dcbbf 100644 --- a/spec/unit/system_spec.rb +++ b/spec/unit/system_spec.rb @@ -23,21 +23,19 @@ require 'ohai/mixin/os' describe "Ohai::System" do extend IntegrationSupport - describe "#initialize" do - before(:each) do - @ohai = Ohai::System.new - end + let(:ohai) { Ohai::System.new } + describe "#initialize" do it "should return an Ohai::System object" do - @ohai.should be_a_kind_of(Ohai::System) + ohai.should be_a_kind_of(Ohai::System) end it "should set @attributes to a ProvidesMap" do - @ohai.provides_map.should be_a_kind_of(Ohai::ProvidesMap) + ohai.provides_map.should be_a_kind_of(Ohai::ProvidesMap) end it "should set @v6_dependency_solver to a Hash" do - @ohai.v6_dependency_solver.should be_a_kind_of(Hash) + ohai.v6_dependency_solver.should be_a_kind_of(Hash) end end @@ -53,15 +51,14 @@ provides 'fish' EOF before do - @ohai = Ohai::System.new @original_config = Ohai::Config[:plugin_path] Ohai::Config[:plugin_path] = [ path_to(".") ] end it "load_plugins() should load all the plugins" do - @ohai.load_plugins - @ohai.provides_map.map.keys.should include("seals") - @ohai.v6_dependency_solver.keys.should include("lake.rb") + ohai.load_plugins + ohai.provides_map.map.keys.should include("seals") + ohai.v6_dependency_solver.keys.should include("lake.rb") Ohai::NamedPlugin.const_get(:Zoo).should == Ohai::NamedPlugin::Zoo end end @@ -88,7 +85,6 @@ provides 'bear' EOF before do - @ohai = Ohai::System.new @original_config = Ohai::Config[:plugin_path] Ohai::Config[:plugin_path] = [ path_to("repo1"), path_to("repo2") ] end @@ -98,11 +94,11 @@ EOF end it "load_plugins() should load all the plugins" do - @ohai.load_plugins - @ohai.provides_map.map.keys.should include("seals") - @ohai.provides_map.map.keys.should include("crabs") - @ohai.v6_dependency_solver.keys.should include("lake.rb") - @ohai.v6_dependency_solver.keys.should include("mountain.rb") + ohai.load_plugins + ohai.provides_map.map.keys.should include("seals") + ohai.provides_map.map.keys.should include("crabs") + ohai.v6_dependency_solver.keys.should include("lake.rb") + ohai.v6_dependency_solver.keys.should include("mountain.rb") Ohai::NamedPlugin.const_get(:Zoo).should == Ohai::NamedPlugin::Zoo Ohai::NamedPlugin.const_get(:Nature).should == Ohai::NamedPlugin::Nature end @@ -118,10 +114,6 @@ EOF Ohai::Config[:plugin_path] = @original_config end - before(:each) do - @ohai = Ohai::System.new - end - when_plugins_directory "contains v6 plugins only" do with_plugin("zoo.rb", <