From 6e1b827b73d58ad2625cb1a7459eecc619999efe 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..d2d3a0b 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.unlink + output_temp_file.unlink 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