summaryrefslogtreecommitdiff
path: root/spec/unit/scan_access_control_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-07-02 15:44:57 -0700
committerdanielsdeleo <dan@opscode.com>2013-07-02 19:04:02 -0700
commitc2407b4187f16747979956b90a6dc98f3997b01c (patch)
treee8c17f1147683eac995291486400f8accdb1dcd1 /spec/unit/scan_access_control_spec.rb
parenta3565d9d674c777d9988bcbaa778862a02da5466 (diff)
downloadchef-c2407b4187f16747979956b90a6dc98f3997b01c.tar.gz
Use symlink source when inspecting current permissions
Fixes CHEF-4341 http://tickets.opscode.com/browse/CHEF-4341 When manage_symlink_source is enabled, File providers update current_resource with the security attributes of the source file. Subsequent actions (e.g., running FileAccessControl) use the values set on current_resource to determine if they need to modify the system, so setting them incorrect leads to a file resource being (not) updated incorrectly.
Diffstat (limited to 'spec/unit/scan_access_control_spec.rb')
-rw-r--r--spec/unit/scan_access_control_spec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/unit/scan_access_control_spec.rb b/spec/unit/scan_access_control_spec.rb
index 8fcda0edb1..c83a552626 100644
--- a/spec/unit/scan_access_control_spec.rb
+++ b/spec/unit/scan_access_control_spec.rb
@@ -21,7 +21,8 @@ require 'chef/scan_access_control'
describe Chef::ScanAccessControl do
before do
- @new_resource = Chef::Resource::File.new("/tmp/foo/bar/baz/qux")
+ @new_resource = Chef::Resource::File.new("/tmp/foo/bar/baz/link")
+ @real_file = "/tmp/foo/bar/real/file"
@current_resource = Chef::Resource::File.new(@new_resource.path)
@scanner = Chef::ScanAccessControl.new(@new_resource, @current_resource)
end
@@ -49,7 +50,8 @@ describe Chef::ScanAccessControl do
before do
@stat = mock("File::Stat for #{@new_resource.path}", :uid => 0, :gid => 0, :mode => 00100644)
- File.should_receive(:stat).with(@new_resource.path).and_return(@stat)
+ File.should_receive(:realpath).with(@new_resource.path).and_return(@real_file)
+ File.should_receive(:stat).with(@real_file).and_return(@stat)
File.should_receive(:exist?).with(@new_resource.path).and_return(true)
end