diff options
author | Claire McQuin <claire@getchef.com> | 2014-06-05 14:43:42 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-06-05 14:44:22 -0700 |
commit | 133f6b2758a728d2aeeb2d88c243566eee20f4f6 (patch) | |
tree | 72b53c1524d22ffabd4e3047ee7eb6217755aa7c /spec/unit/resource/registry_key_spec.rb | |
parent | e7273d0b27c25ac218c968c1abf0bf5d332420c9 (diff) | |
download | chef-133f6b2758a728d2aeeb2d88c243566eee20f4f6.tar.gz |
send md5 checksummed registry key if data type is binary/dword/qword
Diffstat (limited to 'spec/unit/resource/registry_key_spec.rb')
-rw-r--r-- | spec/unit/resource/registry_key_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb index 3f227e26b6..00c301d61d 100644 --- a/spec/unit/resource/registry_key_spec.rb +++ b/spec/unit/resource/registry_key_spec.rb @@ -89,6 +89,11 @@ describe Chef::Resource::RegistryKey, "values" do @resource.values.should eql([ { :name => 'poosh', :type => :string, :data => 'carmen' } ]) end + it "should return checksummed data if the type is unsafe" do + @resource.values( { :name => 'poosh', :type => :binary, :data => 255.chr * 1 }) + @resource.values.should eql([ { :name => 'poosh', :type => :binary, :data => "00594fd4f42ba43fc1ca0427a0576295" } ]) + end + it "should throw an exception if the name field is missing" do lambda { @resource.values [ { :type => :string, :data => 'carmen' } ] }.should raise_error(ArgumentError) end @@ -169,3 +174,26 @@ describe Chef::Resource::RegistryKey, "architecture" do lambda { @resource.architecture(100) }.should raise_error(ArgumentError) end end + +describe Chef::Resource::RegistryKey, ":unscrubbed_values" do + before(:each) do + @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') + end + + it "should return unsafe data as-is" do + key_values = [ { :name => 'poosh', :type => :binary, :data => 255.chr * 1 } ] + @resource.values(key_values) + @resource.unscrubbed_values.should eql(key_values) + end +end + +describe Chef::Resource::RegistryKey, "state" do + before(:each) do + @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') + end + + it "should return scrubbed values" do + @resource.values([ { :name => 'poosh', :type => :binary, :data => 255.chr * 1 } ]) + @resource.state.should eql( { :values => [{ :name => 'poosh', :type => :binary, :data => "00594fd4f42ba43fc1ca0427a0576295" }] } ) + end +end |