diff options
author | Claire McQuin <claire@opscode.com> | 2013-08-06 12:00:06 -0700 |
---|---|---|
committer | Claire McQuin <claire@opscode.com> | 2013-08-07 10:27:22 -0700 |
commit | a93acd180f393d6c80833e369e831cc9424e143b (patch) | |
tree | 502fd3b1f974b27982b38d2f1994c6532554628d /spec/unit/plugins/fail_spec.rb | |
parent | 2fdf7078f3497c84ee8469d294030a3b169ea5d0 (diff) | |
download | ohai-a93acd180f393d6c80833e369e831cc9424e143b.tar.gz |
updated and added spec tests for new dsl
Diffstat (limited to 'spec/unit/plugins/fail_spec.rb')
-rw-r--r-- | spec/unit/plugins/fail_spec.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/unit/plugins/fail_spec.rb b/spec/unit/plugins/fail_spec.rb index 01ecc308..58bf5f42 100644 --- a/spec/unit/plugins/fail_spec.rb +++ b/spec/unit/plugins/fail_spec.rb @@ -32,7 +32,7 @@ describe Ohai::System, "plugin fail" do fail_plugin.write("provides \"fail\"require 'thiswillblowupinyourface'\nk=MissingClassName.new\nfail \"ohnoes\"") fail_plugin.close real_plugin=File.open("#{tmp}/plugins/real.rb","w+") - real_plugin.write("provides \"real\"\nreal \"useful\"\n") + real_plugin.write("Ohai.plugin(:Real) do\nprovides \"real\"\ncollect_data do\nreal \"useful\"\nend\nend\n") real_plugin.close @plugin_path=Ohai::Config[:plugin_path] end @@ -40,6 +40,7 @@ describe Ohai::System, "plugin fail" do before(:each) do Ohai::Config[:plugin_path]=["#{tmp}/plugins"] @ohai=Ohai::System.new + @loader=Ohai::Loader.new(@ohai) end after(:all) do @@ -54,8 +55,13 @@ describe Ohai::System, "plugin fail" do end it "should continue gracefully if plugin loading fails" do - @ohai.require_plugin("fail") - @ohai.require_plugin("real") + @loader.load_plugin("#{tmp}/plugins/fail.rb") + @loader.load_plugin("#{tmp}/plugins/real.rb") + + @ohai.plugins.keys.each do |plgn_key| + @ohai.plugins[plgn_key][:plugin].new(@ohai).run + end + @ohai.data[:real].should eql("useful") @ohai.data.should_not have_key("fail") end |