summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2013-06-26 09:54:53 -0700
committerdanielsdeleo <dan@opscode.com>2013-06-26 10:47:47 -0700
commit11a9f6afa2f696b776b3a4cff8d517d8274d2b22 (patch)
treeccc52d19ce15fd7362c329114c8819bfa2234834 /spec/support
parent02cce01e2d351a5974fc10ee755ddf9c9fd36a5d (diff)
downloadchef-11a9f6afa2f696b776b3a4cff8d517d8274d2b22.tar.gz
Update tests to expect normalized filenames
- Relates to CHEF-4312 - Updates unit tests to expect "normalized" filenames where method arguments are now using File.realpath(path) instead of path; on *NIX these are the same, on Windows, \ gets converted to /.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/unit/provider/file.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 5565c90add..69c9f7de90 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -31,12 +31,17 @@ def file_symlink_class
end
end
+def normalized_path
+ File.expand_path(resource_path)
+end
+
def setup_normal_file
File.stub!(:exists?).with(resource_path).and_return(true)
File.stub!(:directory?).with(resource_path).and_return(false)
File.stub!(:directory?).with(enclosing_directory).and_return(true)
File.stub!(:writable?).with(resource_path).and_return(true)
file_symlink_class.stub!(:symlink?).with(resource_path).and_return(false)
+ file_symlink_class.stub!(:symlink?).with(normalized_path).and_return(false)
end
def setup_missing_file
@@ -49,10 +54,11 @@ end
def setup_symlink
File.stub!(:exists?).with(resource_path).and_return(true)
- File.stub!(:directory?).with(resource_path).and_return(false)
+ File.stub!(:directory?).with(normalized_path).and_return(false)
File.stub!(:directory?).with(enclosing_directory).and_return(true)
File.stub!(:writable?).with(resource_path).and_return(true)
file_symlink_class.stub!(:symlink?).with(resource_path).and_return(true)
+ file_symlink_class.stub!(:symlink?).with(normalized_path).and_return(true)
end
def setup_unwritable_file
@@ -377,7 +383,7 @@ shared_examples_for Chef::Provider::File do
provider.should_receive(:diff).at_least(:once).and_return(diff)
provider.should_receive(:checksum).with(tempfile_path).and_return(tempfile_sha256)
provider.should_receive(:checksum).with(resource_path).and_return(tempfile_sha256)
- provider.deployment_strategy.should_receive(:deploy).with(tempfile_path, resource_path)
+ provider.deployment_strategy.should_receive(:deploy).with(tempfile_path, normalized_path)
end
context "when the file was created" do
before { provider.should_receive(:file_created?).at_least(:once).and_return(true) }
@@ -459,12 +465,12 @@ shared_examples_for Chef::Provider::File do
end
it "restores security context on the file" do
- provider.should_receive(:restore_security_context).with(resource_path, false)
+ provider.should_receive(:restore_security_context).with(normalized_path, false)
provider.send(:do_selinux)
end
it "restores security context recursively when told so" do
- provider.should_receive(:restore_security_context).with(resource_path, true)
+ provider.should_receive(:restore_security_context).with(normalized_path, true)
provider.send(:do_selinux, true)
end
end