summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/mixin/properties.rb2
-rw-r--r--spec/unit/resource_spec.rb9
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb
index 89cca2abac..4e00a09002 100644
--- a/lib/chef/mixin/properties.rb
+++ b/lib/chef/mixin/properties.rb
@@ -275,7 +275,7 @@ class Chef
end
# This method returns list of sensitive properties
- # @return [Array<Property>] All identity properties.
+ # @return [Array<Property>] All sensitive properties.
def sensitive_properties
properties.values.empty? ? [] : properties.values.select(&:sensitive?)
end
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 6634390391..ec0026fba9 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -385,7 +385,6 @@ describe Chef::Resource do
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 (false) " do
resource_class = Class.new(Chef::Resource) {
property :foo, String, sensitive: true, desired_state: false
@@ -404,6 +403,14 @@ describe Chef::Resource do
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
+ end
+ end
end
context "Documentation of resources" do