From 2176414d0031c7f0c51a63a5f78779c0b79750b3 Mon Sep 17 00:00:00 2001 From: Vladimir Kochnev Date: Mon, 1 Aug 2022 13:32:31 +0300 Subject: [PATCH] Close tempfile before passing it to libcurl Closes #184 --- spec/session_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/session_spec.rb b/spec/session_spec.rb index 5114dbd..9e8c879 100644 --- a/spec/session_spec.rb +++ b/spec/session_spec.rb @@ -450,12 +450,14 @@ def yaml_load(str) it "should store cookies across multiple requests" do tf = Tempfile.new('cookiejar') + tf.close cookie_jar_path = tf.path @session.handle_cookies(cookie_jar_path) response = @session.get("/setcookie").body - cookie_jar_contents = tf.read + cookie_jar_contents = tf.open.read + tf.unlink expect(cookie_jar_contents).not_to be_empty expect(cookie_jar_contents).to include('Netscape HTTP Cookie File') end