From a5589b13de4ec14d03546ad44f947c9345cc4690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Art=C5=ABrs=20Pirogovs?= Date: Wed, 13 Sep 2023 16:54:45 +0300 Subject: [PATCH] fix tempfile with binmode --- spec/bucket_store_integration_spec.rb | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/spec/bucket_store_integration_spec.rb b/spec/bucket_store_integration_spec.rb index bf68638..22eef94 100644 --- a/spec/bucket_store_integration_spec.rb +++ b/spec/bucket_store_integration_spec.rb @@ -6,8 +6,6 @@ require "tempfile" -require "pry-byebug" - RSpec.describe BucketStore, :integration do before do # Setup AWS connectivity to minio @@ -68,17 +66,8 @@ end after do - if input_temp_file.is_a?(File) - input_temp_file.close - else - input_temp_file.unlink - end - - if output_temp_file.is_a?(File) - output_temp_file.close - else - output_temp_file.unlink - end + input_temp_file.close! + output_temp_file.close! end it "all file are listable on the store" do @@ -108,13 +97,13 @@ context "when the files are binary" do let(:input_temp_file) do - Tempfile.new.binmode.tap do |file| + Tempfile.new(binmode: true).tap do |file| file.write(Random.bytes(1024)) file.rewind end end let(:output_temp_file) do - Tempfile.new.binmode + Tempfile.new(binmode: true) end let(:input_in_memory_buffer) do