spec/unit/plugins/chef_spec.rb in ohai-6.24.2 vs spec/unit/plugins/chef_spec.rb in ohai-7.0.0.rc.0

- old
+ new

@@ -23,21 +23,20 @@ require 'chef/version' describe Ohai::System, "plugin chef" do before(:each) do - @ohai = Ohai::System.new - @ohai.stub!(:require_plugin).and_return(true) + @plugin = get_plugin("chef") end - + it "should set [:chef_packages][:chef][:version] to the current chef version", :if => defined?(Chef) do - @ohai._require_plugin("chef") - @ohai[:chef_packages][:chef][:version].should == Chef::VERSION + @plugin.run + @plugin[:chef_packages][:chef][:version].should == Chef::VERSION end pending "would set [:chef_packages][:chef][:version] if chef was available", :unless => defined?(Chef) - end + rescue LoadError # the chef module is not available, ignoring. describe Ohai::System, "plugin chef" do pending "would set [:chef_packages][:chef][:version] if chef was available", :unless => defined?(Chef)