summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-09-08 17:16:40 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-09-08 17:16:40 -0700
commit0cc0ae46270da20b3bd9045550df2d4fd9ae145f (patch)
treedef399e4500421bac25dfb60e2f7dca74c771efa
parenteac543b05437f6ee1d9f98cc2656e55a189c2934 (diff)
downloadchef-jdm/enforce-owner-unitify.tar.gz
Modify enforce_ownership_and_permissions_spec to be more unit-likejdm/enforce-owner-unitify
-rw-r--r--spec/unit/mixin/enforce_ownership_and_permissions_spec.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
index aeef175ff9..408926293e 100644
--- a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
+++ b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
@@ -49,12 +49,12 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
allow_any_instance_of(Chef::FileAccessControl).to receive(:uid_from_resource).and_return(0)
allow_any_instance_of(Chef::FileAccessControl).to receive(:requires_changes?).and_return(false)
allow_any_instance_of(Chef::FileAccessControl).to receive(:define_resource_requirements)
+ allow_any_instance_of(Chef::FileAccessControl).to receive(:describe_changes)
+
+ passwd_struct = OpenStruct.new(:name => "root", :passwd => "x",
+ :uid => 0, :gid => 0, :dir => '/root',
+ :shell => '/bin/bash')
- passwd_struct = if windows?
- Struct::Passwd.new("root", "x", 0, 0, "/root", "/bin/bash")
- else
- Struct::Passwd.new("root", "x", 0, 0, "root", "/root", "/bin/bash")
- end
group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
allow(Etc).to receive(:getgrgid).and_return(group_struct)
@@ -73,12 +73,12 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
before do
allow_any_instance_of(Chef::FileAccessControl).to receive(:requires_changes?).and_return(true)
allow_any_instance_of(Chef::FileAccessControl).to receive(:uid_from_resource).and_return(0)
+ allow_any_instance_of(Chef::FileAccessControl).to receive(:describe_changes)
+
+ passwd_struct = OpenStruct.new(:name => "root", :passwd => "x",
+ :uid => 0, :gid => 0, :dir => '/root',
+ :shell => '/bin/bash')
- passwd_struct = if windows?
- Struct::Passwd.new("root", "x", 0, 0, "/root", "/bin/bash")
- else
- Struct::Passwd.new("root", "x", 0, 0, "root", "/root", "/bin/bash")
- end
group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
allow(Etc).to receive(:getgrgid).and_return(group_struct)