Skip to content

Commit

Permalink
Re-add support for Ruby 2.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia committed Jan 6, 2022
1 parent 554930c commit 5d430eb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -42,7 +42,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1']
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1']

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -8,7 +8,7 @@ require:
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
TargetRubyVersion: 2.6
TargetRubyVersion: 2.4

Inclusivity/Race:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion faraday.gemspec
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
spec.homepage = 'https://lostisland.github.io/faraday'
spec.licenses = ['MIT']

spec.required_ruby_version = '>= 2.6'
spec.required_ruby_version = '>= 2.4'

spec.add_dependency 'faraday-em_http', '~> 1.0'
spec.add_dependency 'faraday-em_synchrony', '~> 1.0'
Expand Down
12 changes: 7 additions & 5 deletions spec/faraday/request/instrumentation_spec.rb
Expand Up @@ -30,11 +30,13 @@ def instrument(name, env)

it { expect(options.name).to eq('request.faraday') }
it 'defaults to ActiveSupport::Notifications' do
res = options.instrumenter
rescue NameError => e
expect(e.to_s).to match('ActiveSupport')
else
expect(res).to eq(ActiveSupport::Notifications)
begin
res = options.instrumenter
rescue NameError => e
expect(e.to_s).to match('ActiveSupport')
else
expect(res).to eq(ActiveSupport::Notifications)
end
end

it 'instruments with default name' do
Expand Down
3 changes: 2 additions & 1 deletion spec/support/webmock_rack_app.rb
Expand Up @@ -41,7 +41,8 @@ def req_uri(env)

def req_headers(env)
http_headers = env.select { |k, _| k.start_with?('HTTP_') }
.transform_keys { |k| k[5..] }
.map { |k, v| [k[5..-1], v] }
.to_h

special_headers = Faraday::Adapter::Rack::SPECIAL_HEADERS
http_headers.merge(env.select { |k, _| special_headers.include?(k) })
Expand Down

0 comments on commit 5d430eb

Please sign in to comment.