Skip to content

Commit

Permalink
Re-add support for Ruby 2.4+ (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia authored Jan 6, 2022
1 parent 7ab168e commit c590d85
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ jobs:
matrix:
## Due to https://github.com/actions/runner/issues/849,
## we have to use quotes for '3.0'
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@v2
- name: Set up Ruby
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inherit_mode:
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
TargetRubyVersion: 2.6
TargetRubyVersion: 2.4
SuggestExtensions: false
NewCops: enable

Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ group :test do
gem 'bundler', '~> 2.0'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.0'
gem 'simplecov', '~> 0.21.0'
gem 'simplecov', '~> 0.18.0'

gem 'rubocop', '~> 1.21.0'
gem 'rubocop', '~> 1.12.0'
gem 'rubocop-packaging', '~> 0.5.0'
gem 'rubocop-performance', '~> 1.0'
gem 'rubocop-rspec', '~> 2.0'
Expand Down
2 changes: 1 addition & 1 deletion faraday-retry.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ Gem::Specification.new do |spec|

spec.files = Dir['lib/**/*', 'README.md', 'LICENSE.md', 'CHANGELOG.md']

spec.required_ruby_version = '>= 2.6', '< 4'
spec.required_ruby_version = '>= 2.4', '< 4'
end
2 changes: 1 addition & 1 deletion lib/faraday/retry/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def retry_if
end

def retry_block
self[:retry_block] ||= proc {}
self[:retry_block] ||= proc {} # rubocop:disable Lint/EmptyBlock
end

def retry_statuses
Expand Down
10 changes: 8 additions & 2 deletions spec/faraday/retry/middleware_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# frozen_string_literal: true

PartClass = if defined?(Faraday::Multipart::FilePart)
Faraday::Multipart::FilePart
else
Faraday::FilePart
end

RSpec.describe Faraday::Retry::Middleware do
let(:calls) { [] }
let(:times_called) { calls.size }
Expand Down Expand Up @@ -177,7 +183,7 @@

it 'FilePart: should rewind files on retry' do
io = StringIO.new('Test data')
filepart = Faraday::Multipart::FilePart.new(io, 'application/octet/stream')
filepart = PartClass.new(io, 'application/octet/stream')

rewound = 0
rewind = -> { rewound += 1 }
Expand All @@ -191,7 +197,7 @@

it 'UploadIO: should rewind files on retry' do
io = StringIO.new('Test data')
upload_io = Faraday::Multipart::FilePart.new(io, 'application/octet/stream')
upload_io = PartClass.new(io, 'application/octet/stream')

rewound = 0
rewind = -> { rewound += 1 }
Expand Down

0 comments on commit c590d85

Please sign in to comment.