summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-02-22 14:45:54 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2021-02-22 14:45:54 -0800
commit173a86bb2eeac6acf38bcb8d287bb21933062347 (patch)
tree0d35941cb825b08a573ee4ff16d44a295a1efc86 /spec
parenta6df47ee32febed0de0def8b4e9df79f68ef91dc (diff)
downloadchef-173a86bb2eeac6acf38bcb8d287bb21933062347.tar.gz
Fix tests broken by unlazying defaults
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/property_spec.rb2
-rw-r--r--spec/unit/provider/group_spec.rb8
2 files changed, 5 insertions, 5 deletions
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