From 44374a7517fd0fc6204ad1882891d079d2995e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Laszlo?= Date: Mon, 13 Feb 2023 18:24:47 +0100 Subject: [PATCH 1/2] Fix an error formatting bug --- lib/http/cookie_jar/abstract_store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/http/cookie_jar/abstract_store.rb b/lib/http/cookie_jar/abstract_store.rb index 9c062ed..3a4594f 100644 --- a/lib/http/cookie_jar/abstract_store.rb +++ b/lib/http/cookie_jar/abstract_store.rb @@ -18,7 +18,7 @@ def implementation(symbol) require 'http/cookie_jar/%s_store' % symbol @@class_map.fetch(symbol) rescue LoadError, IndexError => e - raise IndexError, 'cookie store unavailable: %s, error: %s' % symbol.inspect, e.message + raise IndexError, 'cookie store unavailable: %s, error: %s' % [symbol.inspect, e.message] end end From e7f2eb26e14b54e5b4b367a4e248bbdfdcd713bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Laszlo?= Date: Mon, 13 Feb 2023 18:53:02 +0100 Subject: [PATCH 2/2] Add unit test --- test/test_http_cookie_jar.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_http_cookie_jar.rb b/test/test_http_cookie_jar.rb index 8f57abf..0d49960 100644 --- a/test/test_http_cookie_jar.rb +++ b/test/test_http_cookie_jar.rb @@ -9,6 +9,15 @@ def test_nonexistent_store } end + def test_nonexistent_store_in_config + assert_raise_with_message( + ArgumentError, + /cookie store unavailable: :nonexistent, error: cannot load .*nonexistent_store/ + ) { + HTTP::CookieJar.new(store: :nonexistent) + } + end + def test_erroneous_store Dir.mktmpdir { |dir| Dir.mkdir(File.join(dir, 'http'))