From 6f199eb803e2b3c75521a0aac95909d86923a916 Mon Sep 17 00:00:00 2001 From: eregon Date: Tue, 20 Jun 2017 15:23:50 +0000 Subject: 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 --- spec/rubyspec/core/file/realdirpath_spec.rb | 8 ++++++-- spec/rubyspec/core/file/realpath_spec.rb | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'spec/rubyspec') 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 -- cgit v1.2.3