Skip to content

Commit 59d4263

Browse files
ci: Pin json below 3 when testing against Faraday 1 (#146)
Faraday 1's JSON response middleware passes its options to JSON.parse as a positional hash, which json 3.0 removed, so every Faraday 1 cell fails in spec/json_spec.rb since json 3.0.2 became the default resolution.
1 parent 9414b3b commit 59d4263

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎Gemfile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ install_if -> { ENV['FARADAY_VERSION'] } do
66
gem 'faraday', ENV['FARADAY_VERSION']
77
end
88

9-
if /\D*([\d.]*)/.match(ENV.fetch('FARADAY_VERSION', ''))[1].start_with?('0')
9+
faraday_version = /\D*([\d.]*)/.match(ENV.fetch('FARADAY_VERSION', ''))[1]
10+
11+
if faraday_version.start_with?('0')
1012
gem 'faraday_middleware'
1113
elsif ENV['FARADAY_ADAPTER'] == 'em_http'
1214
gem 'faraday-em_http'
1315
end
1416

17+
# Faraday 1's JSON response middleware passes its options to JSON.parse as a
18+
# positional hash, which json 3 no longer accepts.
19+
gem 'json', '< 3' if faraday_version.start_with?('1')
20+
1521
gem 'activesupport', '>= 7.0'
1622
gem 'em-http-request', '>= 1.1'
1723
gem 'rackup'

0 commit comments

Comments
 (0)