From 3a8701c1f58c6b807482538d7361e7f1dee1204d Mon Sep 17 00:00:00 2001 From: "john.mortlock" Date: Tue, 23 Aug 2022 12:28:33 +0930 Subject: [PATCH] Align ruby and rails support with the main doorkeeper gem --- .ruby-version | 2 +- doorkeeper-openid_connect.gemspec | 2 +- spec/dummy/config/database.yml | 13 +++---- .../initializers/new_framework_defaults.rb | 19 ---------- spec/rails_helper.rb | 3 -- spec/support/http_method_shim.rb | 36 ------------------- 6 files changed, 9 insertions(+), 66 deletions(-) delete mode 100644 spec/dummy/config/initializers/new_framework_defaults.rb delete mode 100644 spec/support/http_method_shim.rb diff --git a/.ruby-version b/.ruby-version index 37c2961..ef538c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +3.1.2 diff --git a/doorkeeper-openid_connect.gemspec b/doorkeeper-openid_connect.gemspec index 7f4bb45..6e08e59 100644 --- a/doorkeeper-openid_connect.gemspec +++ b/doorkeeper-openid_connect.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.5' + spec.required_ruby_version = '>= 2.6' spec.add_runtime_dependency 'doorkeeper', '>= 5.5', '< 5.7' spec.add_runtime_dependency 'json-jwt', '>= 1.11.0' diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml index 1c1a37c..5403ee5 100644 --- a/spec/dummy/config/database.yml +++ b/spec/dummy/config/database.yml @@ -4,22 +4,23 @@ # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # -default: &default +development: adapter: sqlite3 pool: 5 timeout: 5000 - -development: - <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: - <<: *default + adapter: sqlite3 + pool: 5 + timeout: 5000 database: db/test.sqlite3 production: - <<: *default + adapter: sqlite3 + pool: 5 + timeout: 5000 database: db/production.sqlite3 diff --git a/spec/dummy/config/initializers/new_framework_defaults.rb b/spec/dummy/config/initializers/new_framework_defaults.rb deleted file mode 100644 index 9e99004..0000000 --- a/spec/dummy/config/initializers/new_framework_defaults.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -# Require `belongs_to` associations by default. This is a new Rails 5.0 -# default, so it is introduced as a configuration option to ensure that apps -# made on earlier versions of Rails are not affected when upgrading. -if Rails::VERSION::MAJOR >= 5 - Rails.application.config.active_record.belongs_to_required_by_default = true - - if Rails::VERSION::MINOR >= 2 - Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true - end -else - # monkey-patch versioned migrations in Rails < 5.0 - class ActiveRecord::Migration - def self.[](_version) - self - end - end -end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 13b83df..79b9c48 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -30,9 +30,6 @@ ActiveRecord::Migration.maintain_test_schema! end -# Remove after dropping support of Rails 4.2 -require_relative 'support/http_method_shim.rb' - require_relative 'support/doorkeeper_configuration.rb' require 'factory_bot' diff --git a/spec/support/http_method_shim.rb b/spec/support/http_method_shim.rb deleted file mode 100644 index 5da4d7e..0000000 --- a/spec/support/http_method_shim.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -# Rails 5 deprecates calling HTTP action methods with positional arguments -# in favor of keyword arguments. However, the keyword argument form is only -# supported in Rails 5+. Since we support back to 4, we need some sort of shim -# to avoid super noisy deprecations when running tests. -module RoutingHTTPMethodShim - def get(path, **args) - super(path, args[:params], args[:headers]) - end - - def post(path, **args) - super(path, args[:params], args[:headers]) - end - - def put(path, **args) - super(path, args[:params], args[:headers]) - end -end - -module ControllerHTTPMethodShim - def process(action, http_method = 'GET', **args) - if (as = args.delete(:as)) - @request.headers['Content-Type'] = Mime[as].to_s - end - - super(action, http_method, args[:params], args[:session], args[:flash]) - end -end - -if ::Rails::VERSION::MAJOR < 5 - RSpec.configure do |config| - config.include ControllerHTTPMethodShim, type: :controller - config.include RoutingHTTPMethodShim, type: :request - end -end