1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
eregon 2017-06-20 15:23:50 +00:00
parent 8ae9de372a
commit 6f199eb803
2 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -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