summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-09-10 06:01:57 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-09-10 06:01:57 -0700
commit6ed7267f1d8da6c2cc9baca30b5712e995355ce2 (patch)
tree129ee48f393eadc15dbecd52878153978911010a
parent9cf93f1eeaad2b2ca4492767bfa13fbe6e30fbe4 (diff)
parent0cc0ae46270da20b3bd9045550df2d4fd9ae145f (diff)
downloadchef-6ed7267f1d8da6c2cc9baca30b5712e995355ce2.tar.gz
Merge pull request #3898 from chef/jdm/enforce-owner-unitify
Modify enforce_ownership_and_permissions_spec to be more unit-like
-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)