summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-20 15:23:50 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-20 15:23:50 +0000
commit6f199eb803e2b3c75521a0aac95909d86923a916 (patch)
treeb52da4bcf3bcf4444bf613c31eca25f94d3bc007 /spec
parent8ae9de372ab9a8d88de5eee02d7e4e7287a24872 (diff)
Use a file under tmp for File.real{,dir}path specs on Windows
* The source file path could have pre-existing symlinks. * See https://github.com/ruby/spec/issues/445. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
-rw-r--r--spec/rubyspec/core/file/realdirpath_spec.rb8
-rw-r--r--spec/rubyspec/core/file/realpath_spec.rb12
2 files changed, 16 insertions, 4 deletions
diff --git a/spec/rubyspec/core/file/realdirpath_spec.rb b/spec/rubyspec/core/file/realdirpath_spec.rb
index 3d50b8813c..06900ad461 100644
--- a/spec/rubyspec/core/file/realdirpath_spec.rb
+++ b/spec/rubyspec/core/file/realdirpath_spec.rb
@@ -88,9 +88,13 @@ platform_is :windows do
@file = tmp("realdirpath")
end
+ after :each do
+ rm_r @file
+ end
+
it "returns the same path" do
- file = __FILE__
- File.realdirpath(file).should == file
+ touch @file
+ File.realdirpath(@file).should == @file
end
it "returns the same path even if the last component does not exist" do
diff --git a/spec/rubyspec/core/file/realpath_spec.rb b/spec/rubyspec/core/file/realpath_spec.rb
index e6ddfdad7c..49aed7b88c 100644
--- a/spec/rubyspec/core/file/realpath_spec.rb
+++ b/spec/rubyspec/core/file/realpath_spec.rb
@@ -72,9 +72,17 @@ end
platform_is :windows do
describe "File.realpath" do
+ before :each do
+ @file = tmp("realpath")
+ touch @file
+ end
+
+ after :each do
+ rm_r @file
+ end
+
it "returns the same path" do
- file = __FILE__
- File.realpath(file).should == file
+ File.realpath(@file).should == @file
end
end
end