diff options
author | sersut <serdar@opscode.com> | 2013-12-17 10:09:22 -0800 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-12-17 15:29:09 -0800 |
commit | 2d6ecaec6bae1eaa866c5787c193512386144b16 (patch) | |
tree | c5c3a4bc388ab3d7d996a3c7c0d0b8c1a290090a | |
parent | 41eec05c15b2e88298ac0e4a9f0742204814f29e (diff) | |
download | ohai-OC-10876.tar.gz |
Add spec test to check the platform specific collect_data check.OC-10876
-rw-r--r-- | spec/unit/system_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb index 1d6d8b87..4e88a52f 100644 --- a/spec/unit/system_spec.rb +++ b/spec/unit/system_spec.rb @@ -18,6 +18,7 @@ # require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') +require 'ohai/mixin/os' describe "Ohai::System" do extend IntegrationSupport @@ -216,6 +217,28 @@ EOF end end + when_plugins_directory "contains a v7 plugins with :default and platform specific blocks" do + with_plugin("message.rb", <<EOF) +Ohai.plugin(:Message) do + provides 'message' + + collect_data(:default) do + message("default") + end + + collect_data(:#{Ohai::Mixin::OS.collect_os}) do + message("platform_specific_message") + end +end +EOF + + it "should collect platform specific" do + Ohai::Config[:plugin_path] = [ path_to(".") ] + @ohai.all_plugins + @ohai.data[:message].should == "platform_specific_message" + end + end + when_plugins_directory "contains v7 plugins only" do with_plugin("zoo.rb", <<EOF) Ohai.plugin(:Zoo) do |