diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-09-10 06:01:57 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-09-10 06:01:57 -0700 |
commit | 6ed7267f1d8da6c2cc9baca30b5712e995355ce2 (patch) | |
tree | 129ee48f393eadc15dbecd52878153978911010a | |
parent | 9cf93f1eeaad2b2ca4492767bfa13fbe6e30fbe4 (diff) | |
parent | 0cc0ae46270da20b3bd9045550df2d4fd9ae145f (diff) | |
download | chef-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.rb | 20 |
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) |