summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshwin <avarma@msystechnologies.com>2021-08-26 14:01:13 +0530
committerAshwin <avarma@msystechnologies.com>2021-08-26 14:01:13 +0530
commitfdc2f684cecc5dd8609cdd1b399e0644b87dd64f (patch)
tree8ae00324d9f4f3420080daf65ce8cc74e677b133
parent698505a169fab60906a7e22c0fa1d874fa769b92 (diff)
downloadchef-fdc2f684cecc5dd8609cdd1b399e0644b87dd64f.tar.gz
Adding the required specs
Signed-off-by: Ashwin <avarma@msystechnologies.com>
-rw-r--r--spec/unit/provider/directory_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb
index 5df3a7163e..b7814c2763 100644
--- a/spec/unit/provider/directory_spec.rb
+++ b/spec/unit/provider/directory_spec.rb
@@ -164,11 +164,18 @@ describe Chef::Provider::Directory do
expect { directory.run_action(:create) }.to raise_error(Chef::Exceptions::InsufficientPermissions)
end
- it "does not raise any exception if the parent directory is exists and writable " do
+ it "does not raise any exception if the parent directory is exists and writable" do
allow(::File).to receive(:exist?).and_return(true)
allow(Chef::FileAccessControl).to receive(:writable?).and_return(true)
expect { directory.run_action(:create) }.not_to raise_error(Chef::Exceptions::InsufficientPermissions)
end
+
+ it "lets does not raise error if child directory exists and writable even if parent directory is read-only" do
+ allow(Chef::FileAccessControl).to receive(:writable?).with(anything).and_return(false)
+ allow(Chef::FileAccessControl).to receive(:writable?).with('/tmp/').and_return(false)
+ allow(Chef::FileAccessControl).to receive(:writable?).with(new_resource.path).and_return(true)
+ expect { directory.run_action(:create) }.not_to raise_error
+ end
end
describe "when the directory does not exist" do