diff options
| author | Bryan McLellan <btm@loftninjas.org> | 2016-09-30 12:17:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-30 12:17:29 -0400 |
| commit | f9a8e2c16f8073f7af6a4414f51d69f644ef97aa (patch) | |
| tree | 9473f69d46b97e9e36b8067ed4d2e43ebd2cdec5 /spec/unit/resource | |
| parent | e56ed315fb7a3cd07724985349f67bc6d7afc0a5 (diff) | |
| parent | a53f31ceba2fc7ce51b6e5713dcb628c401f7ea9 (diff) | |
| download | chef-f9a8e2c16f8073f7af6a4414f51d69f644ef97aa.tar.gz | |
Merge pull request #5359 from MsysTechnologiesllc/ali/windows_registry_key_resource_delete_fix
Allow deletion of registry_key without the need for users to pass data key in values hash.
Diffstat (limited to 'spec/unit/resource')
| -rw-r--r-- | spec/unit/resource/registry_key_spec.rb | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb index 472c511857..d378da3ed0 100644 --- a/spec/unit/resource/registry_key_spec.rb +++ b/spec/unit/resource/registry_key_spec.rb @@ -94,19 +94,11 @@ describe Chef::Resource::RegistryKey, "values" do expect(@resource.values).to eql([ { :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" } ]) end - it "should throw an exception if the name field is missing" do + it "should raise an exception if the name field is missing" do expect { @resource.values [ { :type => :string, :data => "carmen" } ] }.to raise_error(ArgumentError) end - it "should throw an exception if the type field is missing" do - expect { @resource.values [ { :name => "poosh", :data => "carmen" } ] }.to raise_error(ArgumentError) - end - - it "should throw an exception if the data field is missing" do - expect { @resource.values [ { :name => "poosh", :type => :string } ] }.to raise_error(ArgumentError) - end - - it "should throw an exception if extra fields are present" do + it "should raise an exception if extra fields are present" do expect { @resource.values [ { :name => "poosh", :type => :string, :data => "carmen", :screwdriver => "sonic" } ] }.to raise_error(ArgumentError) end @@ -117,6 +109,30 @@ describe Chef::Resource::RegistryKey, "values" do it "should not allow an integer" do expect { @resource.send(:values, 100) }.to raise_error(ArgumentError) end + + it "should raise an exception if type of name is not string" do + expect { @resource.values([ { :name => 123, :type => :string, :data => "carmen" } ]) }.to raise_error(ArgumentError) + end + + it "should not raise an exception if type of name is string" do + expect { @resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error + end + + context "type key not given" do + it "should not raise an exception" do + expect { @resource.values([ { :name => "123", :data => "carmen" } ]) }.to_not raise_error + end + end + + context "type key given" do + it "should raise an exception if type of type is not symbol" do + expect { @resource.values([ { :name => "123", :type => "string", :data => "carmen" } ]) }.to raise_error(ArgumentError) + end + + it "should not raise an exception if type of type is symbol" do + expect { @resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error + end + end end describe Chef::Resource::RegistryKey, "recursive" do |
