diff options
author | Lamont Granquist <lamont@opscode.com> | 2012-12-03 11:42:15 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@opscode.com> | 2012-12-19 15:56:08 -0800 |
commit | f7f5d7e7119defebffb161ac482f5a4118f5c462 (patch) | |
tree | 1bec4e7511f043d155f4c7feca0dc9f27af1a9f7 /spec/functional | |
parent | 51187c615269021717b6874115da1636ce0e59d4 (diff) | |
download | chef-f7f5d7e7119defebffb161ac482f5a4118f5c462.tar.gz |
test for throwing exception on non-windows server
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/resource/registry_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb index ff95f23cf9..e5708d4f7a 100644 --- a/spec/functional/resource/registry_spec.rb +++ b/spec/functional/resource/registry_spec.rb @@ -19,6 +19,25 @@ require "chef/win32/registry" require "spec_helper" +describe Chef::Resource::RegistryKey, :unix_only do + before(:all) do + events = Chef::EventDispatch::Dispatcher.new + node = Chef::Node.new + ohai = Ohai::System.new + ohai.all_plugins + node.consume_external_attrs(ohai.data,{}) + run_context = Chef::RunContext.new(node, {}, events) + @resource = Chef::Resource::RegistryKey.new("HKCU\\Software", run_context) + end + context "when load_current_resource is run on a non-windows node" do + it "throws an exception because you don't have a windows registry (derp)" do + @resource.key("HKCU\\Software\\Opscode") + @resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}]) + lambda{@resource.run_action(:create)}.should raise_error(Chef::Exceptions::Win32NotWindows) + end + end +end + describe Chef::Resource::RegistryKey, :windows_only do before(:all) do |