From 492630b9f89592443b25cacc502b5979f42e16c9 Mon Sep 17 00:00:00 2001 From: Bapu L Date: Wed, 22 Jun 2022 15:02:44 +0530 Subject: Fixed code style issue Signed-off-by: Bapu L --- spec/unit/resource_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'spec') diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index c83398e7c2..c1863be64f 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -371,6 +371,9 @@ describe Chef::Resource do end describe "to_text" do + + let(:sensitive_property_masked_value) { "sensitive value suppressed" } + it "prints nice message" do resource_class = Class.new(Chef::Resource) { property :foo, String } resource = resource_class.new("sensitive_property_tests") @@ -383,7 +386,7 @@ describe Chef::Resource 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\*"/) + expect(resource.to_text).to match(/foo "\*#{sensitive_property_masked_value}\*"/) end it "suppresses that properties value irrespective of desired state (false) " do resource_class = Class.new(Chef::Resource) { @@ -391,7 +394,7 @@ describe Chef::Resource do } resource = resource_class.new("desired_state_property_tests") resource.foo = "some value" - expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/) + expect(resource.to_text).to match(/foo "\*#{sensitive_property_masked_value}\*"/) end it "suppresses that properties value irrespective of desired state (true) " do @@ -400,7 +403,7 @@ describe Chef::Resource do } resource = resource_class.new("desired_state_property_tests") resource.foo = "some value" - expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/) + expect(resource.to_text).to match(/foo "\*#{sensitive_property_masked_value}\*"/) end end -- cgit v1.2.1