mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-08 22:37:57 -05:00
Test against Rails main and remove ActiveSupport::Dependencies.reference (#5357)
Remove `ActiveSupport::Dependencies.reference`
This was deleted from Rails: 14d4edd7c3
As far as I can tell, it was meant to add a performance boost at some point in the past but doesn't seem to do anything useful these days.
This commit is contained in:
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
@@ -7,6 +7,8 @@ jobs:
|
||||
matrix:
|
||||
gemfile:
|
||||
- Gemfile
|
||||
- gemfiles/Gemfile-rails-main
|
||||
- gemfiles/Gemfile-rails-6-1
|
||||
- gemfiles/Gemfile-rails-6-0
|
||||
- gemfiles/Gemfile-rails-5-2
|
||||
- gemfiles/Gemfile-rails-5-1
|
||||
@@ -30,6 +32,10 @@ jobs:
|
||||
gemfile: Gemfile
|
||||
- ruby: 2.1
|
||||
gemfile: gemfiles/Gemfile-rails-6-0
|
||||
- ruby: 2.1
|
||||
gemfile: gemfiles/Gemfile-rails-6-1
|
||||
- ruby: 2.1
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
- ruby: 2.1
|
||||
gemfile: gemfiles/Gemfile-rails-5-2
|
||||
- ruby: 2.1
|
||||
@@ -40,24 +46,40 @@ jobs:
|
||||
gemfile: Gemfile
|
||||
- ruby: 2.2
|
||||
gemfile: gemfiles/Gemfile-rails-6-0
|
||||
- ruby: 2.2
|
||||
gemfile: gemfiles/Gemfile-rails-6-1
|
||||
- ruby: 2.2
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
- ruby: 2.2
|
||||
gemfile: gemfiles/Gemfile-rails-5-2
|
||||
- ruby: 2.3
|
||||
gemfile: Gemfile
|
||||
- ruby: 2.3
|
||||
gemfile: gemfiles/Gemfile-rails-6-0
|
||||
- ruby: 2.3
|
||||
gemfile: gemfiles/Gemfile-rails-6-1
|
||||
- ruby: 2.3
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
- ruby: 2.4
|
||||
gemfile: Gemfile
|
||||
- ruby: 2.4
|
||||
gemfile: gemfiles/Gemfile-rails-6-0
|
||||
- ruby: 2.4
|
||||
gemfile: gemfiles/Gemfile-rails-6-1
|
||||
- ruby: 2.4
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
- ruby: 2.4
|
||||
gemfile: gemfiles/Gemfile-rails-4-1
|
||||
- ruby: 2.5
|
||||
gemfile: gemfiles/Gemfile-rails-4-1
|
||||
- ruby: 2.5
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
- ruby: 2.6
|
||||
gemfile: gemfiles/Gemfile-rails-4-1
|
||||
- ruby: 2.6
|
||||
gemfile: gemfiles/Gemfile-rails-4-2
|
||||
- ruby: 2.6
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
- ruby: 2.7
|
||||
gemfile: gemfiles/Gemfile-rails-4-1
|
||||
- ruby: 2.7
|
||||
@@ -88,6 +110,10 @@ jobs:
|
||||
gemfile: gemfiles/Gemfile-rails-5-2
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile-rails-6-0
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile-rails-6-1
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile-rails-main
|
||||
runs-on: ubuntu-latest
|
||||
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
||||
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
||||
|
||||
27
gemfiles/Gemfile-rails-6-1
Normal file
27
gemfiles/Gemfile-rails-6-1
Normal file
@@ -0,0 +1,27 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 6.1.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.0"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
27
gemfiles/Gemfile-rails-main
Normal file
27
gemfiles/Gemfile-rails-main
Normal file
@@ -0,0 +1,27 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "main"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.0"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
@@ -318,7 +318,9 @@ module Devise
|
||||
end
|
||||
|
||||
def self.ref(arg)
|
||||
ActiveSupport::Dependencies.reference(arg)
|
||||
if ActiveSupport::Dependencies.respond_to?(:reference)
|
||||
ActiveSupport::Dependencies.reference(arg)
|
||||
end
|
||||
Getter.new(arg)
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ ActiveRecord::Base.logger = Logger.new(nil)
|
||||
ActiveRecord::Base.include_root_in_json = true
|
||||
|
||||
migrate_path = File.expand_path("../../rails_app/db/migrate/", __FILE__)
|
||||
if Devise::Test.rails6?
|
||||
if Devise::Test.rails6_and_up?
|
||||
ActiveRecord::MigrationContext.new(migrate_path, ActiveRecord::SchemaMigration).migrate
|
||||
elsif Devise::Test.rails52_and_up?
|
||||
ActiveRecord::MigrationContext.new(migrate_path).migrate
|
||||
|
||||
@@ -46,7 +46,7 @@ module RailsApp
|
||||
end
|
||||
|
||||
# Remove the first check once Rails 5.0 support is removed.
|
||||
if Devise::Test.rails52_and_up? && !Devise::Test.rails6?
|
||||
if Devise::Test.rails52_and_up? && !Devise::Test.rails6_and_up?
|
||||
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,9 +7,9 @@ end
|
||||
module Devise
|
||||
module Test
|
||||
# Detection for minor differences between Rails versions in tests.
|
||||
|
||||
def self.rails6?
|
||||
Rails.version.start_with? '6'
|
||||
|
||||
def self.rails6_and_up?
|
||||
Rails::VERSION::MAJOR >= 6
|
||||
end
|
||||
|
||||
def self.rails52_and_up?
|
||||
|
||||
@@ -103,7 +103,7 @@ class TestControllerHelpersTest < Devise::ControllerTestCase
|
||||
test "returns the content type of a failure app" do
|
||||
get :index, params: { format: :json }
|
||||
|
||||
if Devise::Test.rails6?
|
||||
if Devise::Test.rails6_and_up?
|
||||
assert_includes response.media_type, 'application/json'
|
||||
else
|
||||
assert_includes response.content_type, 'application/json'
|
||||
|
||||
Reference in New Issue
Block a user