summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-07 16:05:46 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-07 16:05:46 -0800
commit9a2a474553d8595f7ba6ad4515fe24b92ee8c5aa (patch)
tree46a95046b6db7484ad9146398b23ebd56b13b10f
parente314d34fc54645d9b1a69dc4f63f3421134f89d1 (diff)
downloadchef-9a2a474553d8595f7ba6ad4515fe24b92ee8c5aa.tar.gz
Make tests unix_only where the stubs don't work on windows.
Functionality is covered by functional tests, so we have test coverage to fall back on until the unit tests are fixed.
-rw-r--r--spec/unit/provider/directory_spec.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb
index 3c561b57af..ef35f1346b 100644
--- a/spec/unit/provider/directory_spec.rb
+++ b/spec/unit/provider/directory_spec.rb
@@ -80,11 +80,15 @@ describe Chef::Provider::Directory do
end
end
- it "should create a new directory on create, setting updated to true" do
+ # Unix only for now. While file security attribute reporting for windows is
+ # disabled, unix and windows differ in the number of exist? calls that are
+ # made by the provider.
+ it "should create a new directory on create, setting updated to true", :unix_only do
@new_resource.path "/tmp/foo"
File.should_receive(:exist?).exactly(2).and_return(false)
File.should_receive(:directory?).with("/tmp").and_return(true)
+ File.should_receive(:writeable?).with("/tmp").and_return(true)
Dir.should_receive(:mkdir).with(@new_resource.path).once.and_return(true)
@directory.should_receive(:set_all_access_controls)
@@ -99,7 +103,10 @@ describe Chef::Provider::Directory do
lambda { @directory.run_action(:create) }.should raise_error(Chef::Exceptions::EnclosingDirectoryDoesNotExist)
end
- it "should create a new directory when parent directory does not exist if recursive is true and permissions are correct" do
+ # Unix only for now. While file security attribute reporting for windows is
+ # disabled, unix and windows differ in the number of exist? calls that are
+ # made by the provider.
+ it "should create a new directory when parent directory does not exist if recursive is true and permissions are correct", :unix_only do
@new_resource.path "/path/to/dir"
@new_resource.recursive true
File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
@@ -124,7 +131,10 @@ describe Chef::Provider::Directory do
@directory.new_resource.should_not be_updated
end
- it "should not create the directory if it already exists" do
+ # Unix only for now. While file security attribute reporting for windows is
+ # disabled, unix and windows differ in the number of exist? calls that are
+ # made by the provider.
+ it "should not create the directory if it already exists", :unix_only do
stub_file_cstats
@new_resource.path "/tmp/foo"
File.should_receive(:directory?).twice.and_return(true)