Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for Ruby v2.7, v3.0 #71

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.1', '3.2']
ruby-version: ['3.1', '3.2']
gemfile: [ rails_6.1, rails_7.0, rails_7.1 ]
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
Expand All @@ -25,7 +25,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
rubygems: 3.4.10
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rspec
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inherit_mode:

AllCops:
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.1
Exclude:
- 'spec/dummy/config/**/*'
- 'spec/dummy/app/**/*'
Expand Down
6 changes: 3 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-07-02 19:48:59 UTC using RuboCop version 1.64.1.
# on 2024-07-04 09:30:17 UTC using RuboCop version 1.64.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -14,7 +14,7 @@ Gemspec/DevelopmentDependencies:
Exclude:
- 'rpi_auth.gemspec'

# Offense count: 1
# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 23
Expand All @@ -33,7 +33,7 @@ RSpec/MultipleExpectations:
RSpec/MultipleMemoizedHelpers:
Max: 6

# Offense count: 10
# Offense count: 12
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 5
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 2.7.8
ruby 3.1.6
2 changes: 1 addition & 1 deletion app/controllers/rpi_auth/test_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestController < ActionController::Base
layout false

def show
render locals: { login_params: login_params, logout_params: logout_params }
render locals: { login_params:, logout_params: }
end

private
Expand Down
23 changes: 12 additions & 11 deletions gemfiles/rails_6.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ GEM
bindata (2.5.0)
builder (3.3.0)
byebug (11.1.3)
capybara (3.39.2)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -95,13 +95,12 @@ GEM
email_validator (2.2.4)
activemodel
erubi (1.13.0)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday (2.9.2)
faraday-net_http (>= 2.0, < 3.2)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
faraday-net_http (3.1.0)
net-http
ffi (1.17.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -134,6 +133,8 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.24.1)
net-http (0.4.1)
uri
net-imap (0.4.14)
date
net-protocol
Expand All @@ -144,7 +145,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.15.6)
nokogiri (1.16.6)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
omniauth (2.1.2)
Expand Down Expand Up @@ -180,7 +181,7 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.1.1)
public_suffix (6.0.0)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
Expand Down Expand Up @@ -273,10 +274,9 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.1)
rubocop-rspec (3.0.2)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -301,6 +301,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uri (0.13.0)
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
Expand Down
23 changes: 12 additions & 11 deletions gemfiles/rails_7.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ GEM
bindata (2.5.0)
builder (3.3.0)
byebug (11.1.3)
capybara (3.39.2)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -101,13 +101,12 @@ GEM
email_validator (2.2.4)
activemodel
erubi (1.13.0)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday (2.9.2)
faraday-net_http (>= 2.0, < 3.2)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
faraday-net_http (3.1.0)
net-http
ffi (1.17.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -140,6 +139,8 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.24.1)
net-http (0.4.1)
uri
net-imap (0.4.14)
date
net-protocol
Expand All @@ -150,7 +151,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.15.6)
nokogiri (1.16.6)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
omniauth (2.1.2)
Expand Down Expand Up @@ -186,7 +187,7 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.1.1)
public_suffix (6.0.0)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
Expand Down Expand Up @@ -279,10 +280,9 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.1)
rubocop-rspec (3.0.2)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -300,6 +300,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uri (0.13.0)
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
Expand Down
23 changes: 12 additions & 11 deletions gemfiles/rails_7.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ GEM
bindata (2.5.0)
builder (3.3.0)
byebug (11.1.3)
capybara (3.39.2)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -113,13 +113,12 @@ GEM
email_validator (2.2.4)
activemodel
erubi (1.13.0)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday (2.9.2)
faraday-net_http (>= 2.0, < 3.2)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
faraday-net_http (3.1.0)
net-http
ffi (1.17.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -157,6 +156,8 @@ GEM
mini_portile2 (2.8.7)
minitest (5.24.1)
mutex_m (0.2.0)
net-http (0.4.1)
uri
net-imap (0.4.14)
date
net-protocol
Expand All @@ -167,7 +168,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.15.6)
nokogiri (1.16.6)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
omniauth (2.1.2)
Expand Down Expand Up @@ -205,7 +206,7 @@ GEM
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
public_suffix (5.1.1)
public_suffix (6.0.0)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
Expand Down Expand Up @@ -308,10 +309,9 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.1)
rubocop-rspec (3.0.2)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -330,6 +330,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uri (0.13.0)
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
Expand Down
6 changes: 3 additions & 3 deletions lib/rpi_auth/spec_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module SpecHelpers
# This sets up the OmniAuth mock for the given user. It assumes the User
# model has an `:user_id` method which returns the users ID, but this can
# be changed by setting the `id_param` option.
def stub_auth_for(user:, id_param: :user_id) # rubocop:disable Metrics/AbcSize
def stub_auth_for(user:, id_param: :user_id)
expires_in = user.respond_to?(:expires_at) ? user.expires_at.to_i - Time.zone.now.to_i : 3600
token = user.respond_to?(:access_token) ? user.access_token : SecureRandom.hex(16)
refresh_token = user.respond_to?(:refresh_token) ? user.refresh_token : SecureRandom.hex(16)
Expand All @@ -14,7 +14,7 @@ def stub_auth_for(user:, id_param: :user_id) # rubocop:disable Metrics/AbcSize
OmniAuth.config.add_mock(:rpi,
uid: user.send(id_param),
credentials: {
token: token, refresh_token: refresh_token, expires_in: expires_in
token:, refresh_token:, expires_in:
}.compact,
extra: { raw_info: user.serializable_hash(except: id_param) })
end
Expand All @@ -24,7 +24,7 @@ def stub_auth_for(user:, id_param: :user_id) # rubocop:disable Metrics/AbcSize
# In request specs, we just post directly to `/auth/rpi`, so this can be
# called without any prep.
def log_in(user:)
stub_auth_for(user: user)
stub_auth_for(user:)

# This is a bit grotty, but see if we can call `click_on` (from Capybara,
# i.e. system specs) first, and then if that fails fall back to using
Expand Down
8 changes: 4 additions & 4 deletions lib/rpi_auth_bypass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def add_rpi_mock(uid: RpiAuthBypass::DEFAULT_UID,
credentials: RpiAuthBypass::DEFAULT_CREDENTIALS)
add_mock(:rpi, {
provider: :rpi,
uid: uid,
info: info,
extra: extra,
credentials: credentials
uid:,
info:,
extra:,
credentials:
})
end

Expand Down
2 changes: 1 addition & 1 deletion rpi_auth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|

spec.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']

spec.required_ruby_version = '>= 2.7.7'
spec.required_ruby_version = '~> 3.1'

spec.add_dependency 'omniauth_openid_connect', '~> 0.7.1'
spec.add_dependency 'omniauth-rails_csrf_protection', '~> 1.0.0'
Expand Down
Loading
Loading