Merge pull request #42 from andrelaszlo/abstract_store_fix_error_formatting_bug

Fix error formatting bug in HTTP::CookieJar::AbstractStore
This commit is contained in:
Akinori Musha 2023-11-13 23:02:13 +09:00 committed by GitHub
commit 94e2b85861
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class HTTP::CookieJar::AbstractStore
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

View file

@ -9,6 +9,15 @@ module TestHTTPCookieJar
}
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'))