Skip to content

Commit 5e5ec51

Browse files
author
remi Taylor
committed
Fix Language sample spec for Ruby 2.2
Tempfile.new constructor requires basename
1 parent 3804bb4 commit 5e5ec51

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

language/spec/language_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
# Upload a file to Google Cloud Storage for testing
2525
# Uploaded files will be deleted after each test
2626
def upload file_name, text_content
27-
local_file_path = Tempfile.new.path
28-
File.write local_file_path, text_content
29-
@bucket.create_file local_file_path, file_name
27+
local_file = Tempfile.new "language-test-file"
28+
File.write local_file.path, text_content
29+
@bucket.create_file local_file.path, file_name
3030
@uploaded << file_name
31+
ensure
32+
local_file.close
33+
local_file.unlink
3134
end
3235

3336
# Capture and return STDOUT output by block

0 commit comments

Comments
 (0)