# # Author:: Claire McQuin () # Copyright:: Copyright (c) 2013 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe Ohai::Loader do before(:each) do @ohai = Ohai::System.new end describe "#initialize" do it "should return an Ohai::Loader object" do loader = Ohai::Loader.new(@ohai) loader.should be_a_kind_of(Ohai::Loader) end end describe "#load_plugin" do before(:each) do @name = :Test @v6name = "test" @path = "test.rb" @loader = Ohai::Loader.new(@ohai) @loader.stub(:collect_provides).and_return({}) end it "should log a warning if a plugin cannot be loaded" do Ohai::Log.should_receive(:warn).with(/Unable to open or read plugin/) IO.stub(:read).with(anything()).and_raise(IOError) @loader.load_plugin("") end it "should detect a version 6 plugin and emit deprecation message" do contents = <