summaryrefslogtreecommitdiff
path: root/spec/unit/provider/file
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2013-05-23 09:57:51 -0700
committersersut <serdar@opscode.com>2013-05-23 09:57:51 -0700
commitaa13ddee5a7ada2dba8b624ad5325d0132ce883f (patch)
tree2e5d39ee7e5e866a24331ecd70f8153bb62fb85c /spec/unit/provider/file
parent67eb0c2bae18ee50a585140873b93ea6ec0ded2d (diff)
downloadchef-aa13ddee5a7ada2dba8b624ad5325d0132ce883f.tar.gz
Fix specs on windows.
Diffstat (limited to 'spec/unit/provider/file')
-rw-r--r--spec/unit/provider/file/content_spec.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/spec/unit/provider/file/content_spec.rb b/spec/unit/provider/file/content_spec.rb
index 771c889cf1..1e681d5c15 100644
--- a/spec/unit/provider/file/content_spec.rb
+++ b/spec/unit/provider/file/content_spec.rb
@@ -36,9 +36,12 @@ describe Chef::Provider::File::Content do
mock("Chef::Provider::File::Resource (current)")
end
- let(:enclosing_directory) { File.expand_path(File.join(CHEF_SPEC_DATA, "templates")) }
-
- let(:resource_path) { File.expand_path(File.join(enclosing_directory, "seattle.txt")) }
+ let(:enclosing_directory) {
+ canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
+ }
+ let(:resource_path) {
+ canonicalize_path(File.expand_path(File.join(enclosing_directory, "seattle.txt")))
+ }
let(:new_resource) do
mock("Chef::Provider::File::Resource (new)", :name => "seattle.txt", :path => resource_path, :binmode => true)
@@ -71,14 +74,14 @@ describe Chef::Provider::File::Content do
it "returns a tempfile in the tempdir when :file_staging_uses_destdir is not set" do
Chef::Config[:file_staging_uses_destdir] = false
- content.tempfile.path.should match /^#{Dir::tmpdir}/
- content.tempfile.path.should_not match /^#{enclosing_directory}/
+ content.tempfile.path.start_with?(Dir::tmpdir).should be_true
+ canonicalize_path(content.tempfile.path).start_with?(enclosing_directory).should be_false
end
it "returns a tempfile in the destdir when :file_desployment_uses_destdir is not set" do
Chef::Config[:file_staging_uses_destdir] = true
- content.tempfile.path.should_not match /^#{Dir::tmpdir}/
- content.tempfile.path.should match /^#{enclosing_directory}/
+ content.tempfile.path.start_with?(Dir::tmpdir).should be_false
+ canonicalize_path(content.tempfile.path).start_with?(enclosing_directory).should be_true
end
end