summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index fbe4544c19..2f75ba0241 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -354,6 +354,24 @@ describe Chef::Resource do
end
end
+ describe "to_text" do
+ it "prints nice message" do
+ resource_class = Class.new(Chef::Resource) { property :foo, String }
+ resource = resource_class.new("sensitive_property_tests")
+ resource.foo = "some value"
+ expect(resource.to_text).to match(/foo "some value"/)
+ end
+
+ context "when property is sensitive" do
+ it "supresses that properties value" do
+ resource_class = Class.new(Chef::Resource) { property :foo, String, sensitive: true }
+ resource = resource_class.new("sensitive_property_tests")
+ resource.foo = "some value"
+ expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/)
+ end
+ end
+ end
+
describe "self.resource_name" do
context "When resource_name is not set" do
it "and there are no provides lines, resource_name is nil" do