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

Revert the related commits about Tempfile.open change.

Start with fa21985a7a
  to d7492a0be8
This commit is contained in:
Hiroshi SHIBATA 2020-09-09 20:52:48 +09:00
parent 6997109fca
commit b194973dcd
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
6 changed files with 31 additions and 55 deletions

View file

@ -38,10 +38,8 @@ describe "Tempfile.open" do
end
it "is passed an array [base, suffix] as first argument" do
Tempfile.open(["specs", ".tt"]) { |tempfile|
@tempfile = tempfile
tempfile.path.should =~ /specs.*\.tt$/
}
Tempfile.open(["specs", ".tt"]) { |tempfile| @tempfile = tempfile }
@tempfile.path.should =~ /specs.*\.tt$/
end
it "passes the third argument (options) to open" do
@ -67,7 +65,7 @@ describe "Tempfile.open when passed a block" do
end
after :each do
# Tempfile.open with block does not unlink in Ruby <= 2.7
# Tempfile.open with block does not unlink
@tempfile.close! if @tempfile
end
@ -96,24 +94,4 @@ describe "Tempfile.open when passed a block" do
Tempfile.open("specs") { |tempfile| @tempfile = tempfile }
@tempfile.closed?.should be_true
end
ruby_version_is ""..."2.8" do
it "does not unlink the file after the block ends" do
path = Tempfile.open("specs") { |tempfile|
@tempfile = tempfile
tempfile.path
}
File.should.exist?(path)
end
end
ruby_version_is "2.8" do
it "unlinks the file after the block ends" do
path = Tempfile.open("specs") { |tempfile|
@tempfile = tempfile
tempfile.path
}
File.should_not.exist?(path)
end
end
end