diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-20 15:23:50 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-20 15:23:50 +0000 |
commit | a25904ff119adc6cf8d79bacd8067a4d40be8231 (patch) | |
tree | b52da4bcf3bcf4444bf613c31eca25f94d3bc007 /spec/rubyspec/core/file | |
parent | 873f3bbec22f79b3bdeca7062289d0c6fc8a6f7d (diff) | |
download | ruby-a25904ff119adc6cf8d79bacd8067a4d40be8231.tar.gz |
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/rubyspec/core/file')
-rw-r--r-- | spec/rubyspec/core/file/realdirpath_spec.rb | 8 | ||||
-rw-r--r-- | spec/rubyspec/core/file/realpath_spec.rb | 12 |
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 |