diff options
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 |