Skip to content

Commit

Permalink
Merge pull request #1135 from chef/tm/bad_tests_2
Browse files Browse the repository at this point in the history
fix critical plugin tests
  • Loading branch information
tas50 authored Feb 16, 2018
2 parents c99299b + c12a70e commit 02eeb37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spec/unit/system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,22 @@
end

describe "when using :critical_plugins" do
# if called from cli is true, we'll exit these tests
let(:ohai) { Ohai::System.new() }

before do
Ohai.config[:critical_plugins] = [ :Fails ]
end

after do
Ohai.config[:critical_plugins] = []
end

it "should fail when critical plugins fail" do
Ohai.config[:plugin_path] = [ path_to(".") ]
expect(Ohai::Log).to receive(:error).with(/marked as critical/)
ohai.all_plugins
expect { ohai.all_plugins }.to raise_error(Ohai::Exceptions::CriticalPluginFailure,
"The following Ohai plugins marked as critical failed: [:Fails]. Failing Chef run.")
end

end
end
end
Expand Down

0 comments on commit 02eeb37

Please sign in to comment.