diff options
author | Bapu L <bapu.labade@progress.com> | 2022-06-21 14:14:24 +0530 |
---|---|---|
committer | Bapu L <bapu.labade@progress.com> | 2022-06-21 14:14:24 +0530 |
commit | e8086d2733311a17d37698bc6e9d6bdaa2b96068 (patch) | |
tree | 4d633f6d2815979aa881c51713f5f767d350b1f3 /spec | |
parent | 9894e49919e40798b6830720110fe99166b969bf (diff) | |
download | chef-e8086d2733311a17d37698bc6e9d6bdaa2b96068.tar.gz |
Property values should be suppressed irrespective of desired state
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/resource_spec.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index f0a624d5db..6634390391 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -385,13 +385,23 @@ describe Chef::Resource do resource.foo = "some value" expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/) end - end - context "when property is required" do - it "does not propagate validation errors" do - resource_class = Class.new(Chef::Resource) { property :foo, String, required: true } - resource = resource_class.new("required_property_tests") - expect { resource.to_text }.to_not raise_error + it "suppresses that properties value for irrespective of desired state (false) " do + resource_class = Class.new(Chef::Resource) { + property :foo, String, sensitive: true, desired_state: false + } + resource = resource_class.new("desired_state_property_tests") + resource.foo = "some value" + expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/) + end + + it "suppresses that properties value for irrespective of desired state (true) " do + resource_class = Class.new(Chef::Resource) { + property :foo, String, sensitive: true, desired_state: true + } + resource = resource_class.new("desired_state_property_tests") + resource.foo = "some value" + expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/) end end end |