summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@opscode.com>2021-02-22 14:51:58 -0800
committerGitHub <noreply@github.com>2021-02-22 14:51:58 -0800
commit8e205428415b35c46287a046a1f6d07d86d58cef (patch)
tree0d35941cb825b08a573ee4ff16d44a295a1efc86
parenta6df47ee32febed0de0def8b4e9df79f68ef91dc (diff)
parent173a86bb2eeac6acf38bcb8d287bb21933062347 (diff)
downloadchef-8e205428415b35c46287a046a1f6d07d86d58cef.tar.gz
Merge pull request #11087 from chef/lcg/fix-unlazying-tests
Fix tests broken by unlazying defaults
-rw-r--r--lib/chef/resource/file.rb2
-rw-r--r--spec/unit/property_spec.rb2
-rw-r--r--spec/unit/provider/group_spec.rb8
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb
index 5cc510571a..05cb4658d5 100644
--- a/lib/chef/resource/file.rb
+++ b/lib/chef/resource/file.rb
@@ -81,7 +81,7 @@ class Chef
property :manage_symlink_source, [ TrueClass, FalseClass ], desired_state: false,
description: "Change the behavior of the file resource if it is pointed at a symlink. When this value is set to true, #{ChefUtils::Dist::Infra::PRODUCT} will manage the symlink's permissions or will replace the symlink with a normal file if the resource has content. When this value is set to false, #{ChefUtils::Dist::Infra::PRODUCT} will follow the symlink and will manage the permissions and content of symlink's target file. The default behavior is true but emits a warning that the default value will be changed to false in a future version; setting this explicitly to true or false suppresses this warning."
- property :verifications, Array, default: []
+ property :verifications, Array, default: lazy { [] }, desired_state: false, skip_docs: true
def verify(command = nil, opts = {}, &block)
unless command.nil? || [String, Symbol].include?(command.class)
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index d223c14c39..6c64a961b4 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -574,7 +574,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ":x, default: {}" do
+ with_property ":x, default: lazy { {} }" do
it "when x is not set, it returns {}" do
expect(resource.x).to eq({})
end
diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb
index a3701c1f45..c96c29164e 100644
--- a/spec/unit/provider/group_spec.rb
+++ b/spec/unit/provider/group_spec.rb
@@ -101,25 +101,25 @@ describe Chef::Provider::User do
end
it "should return false if append is true and the group member(s) already exists" do
- @current_resource.members << "extra_user"
+ @current_resource.members += [ "extra_user" ]
@new_resource.append(true)
expect(@provider.compare_group).to be_falsey
end
it "should return true if append is true and the group member(s) do not already exist" do
- @new_resource.members << "extra_user"
+ @new_resource.members += [ "extra_user" ]
@new_resource.append(true)
expect(@provider.compare_group).to be_truthy
end
it "should return false if append is true and excluded_members include a non existing member" do
- @new_resource.excluded_members << "extra_user"
+ @new_resource.excluded_members += [ "extra_user" ]
@new_resource.append(true)
expect(@provider.compare_group).to be_falsey
end
it "should return true if the append is true and excluded_members include an existing user" do
- @new_resource.members.each { |m| @new_resource.excluded_members << m }
+ @new_resource.excluded_members += @new_resource.members
@new_resource.members.clear
@new_resource.append(true)
expect(@provider.compare_group).to be_truthy