ruby-changes:47008
From: eregon <ko1@a...>
Date: Wed, 21 Jun 2017 00:23:57 +0900 (JST)
Subject: [ruby-changes:47008] eregon:r59123 (trunk): Use a file under tmp for File.real{, dir}path specs on Windows
eregon 2017-06-21 00:23:50 +0900 (Wed, 21 Jun 2017) New Revision: 59123 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59123 Log: 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. Modified files: trunk/spec/rubyspec/core/file/realdirpath_spec.rb trunk/spec/rubyspec/core/file/realpath_spec.rb Index: spec/rubyspec/core/file/realdirpath_spec.rb =================================================================== --- spec/rubyspec/core/file/realdirpath_spec.rb (revision 59122) +++ spec/rubyspec/core/file/realdirpath_spec.rb (revision 59123) @@ -88,9 +88,13 @@ platform_is :windows do https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/file/realdirpath_spec.rb#L88 @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 Index: spec/rubyspec/core/file/realpath_spec.rb =================================================================== --- spec/rubyspec/core/file/realpath_spec.rb (revision 59122) +++ spec/rubyspec/core/file/realpath_spec.rb (revision 59123) @@ -72,9 +72,17 @@ end https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/file/realpath_spec.rb#L72 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/