From 59609c547d7990ac092b0219d273bdbf10bbd4f6 Mon Sep 17 00:00:00 2001 From: eregon Date: Thu, 1 Jun 2017 17:08:59 +0000 Subject: Create the file in the File::TMPFILE spec in its own directory * Avoids failing the spec if rubyspec_temp is not empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/rubyspec/core/file/open_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/rubyspec') diff --git a/spec/rubyspec/core/file/open_spec.rb b/spec/rubyspec/core/file/open_spec.rb index 09b1cb6add..440921a796 100644 --- a/spec/rubyspec/core/file/open_spec.rb +++ b/spec/rubyspec/core/file/open_spec.rb @@ -522,10 +522,10 @@ describe "File.open" do platform_is :linux do if defined?(File::TMPFILE) it "creates an unnamed temporary file with File::TMPFILE" do - dir = tmp("").chomp("/") - rm_r @file - Dir["#{dir}/*"].should == [] + dir = tmp("tmpfilespec") + mkdir_p dir begin + Dir["#{dir}/*"].should == [] File.open(dir, "r+", flags: File::TMPFILE) do |io| io.write("ruby") io.flush @@ -537,6 +537,8 @@ describe "File.open" do # EOPNOTSUPP: no support from the filesystem # EINVAL: presumably bug in glibc 1.should == 1 + ensure + rm_r dir end end end -- cgit v1.2.3