diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index efe63d78dd..1df5eba5c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} diff --git a/gemfiles/Gemfile-rails-6-1 b/gemfiles/Gemfile-rails-6-1 new file mode 100644 index 0000000000..0a96b0e354 --- /dev/null +++ b/gemfiles/Gemfile-rails-6-1 @@ -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 diff --git a/gemfiles/Gemfile-rails-main b/gemfiles/Gemfile-rails-main new file mode 100644 index 0000000000..536c564c20 --- /dev/null +++ b/gemfiles/Gemfile-rails-main @@ -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 diff --git a/lib/devise.rb b/lib/devise.rb index 0451876df9..4c96810ecf 100644 --- a/lib/devise.rb +++ b/lib/devise.rb @@ -318,7 +318,9 @@ def get end def self.ref(arg) - ActiveSupport::Dependencies.reference(arg) + if ActiveSupport::Dependencies.respond_to?(:reference) + ActiveSupport::Dependencies.reference(arg) + end Getter.new(arg) end diff --git a/test/orm/active_record.rb b/test/orm/active_record.rb index 001f99b993..cf500330ad 100644 --- a/test/orm/active_record.rb +++ b/test/orm/active_record.rb @@ -5,7 +5,7 @@ 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 diff --git a/test/rails_app/config/application.rb b/test/rails_app/config/application.rb index 0c844878a0..d7ecc1606d 100644 --- a/test/rails_app/config/application.rb +++ b/test/rails_app/config/application.rb @@ -46,7 +46,7 @@ class Application < Rails::Application 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 diff --git a/test/rails_app/config/boot.rb b/test/rails_app/config/boot.rb index bc3dfa62d9..3327e5e49e 100644 --- a/test/rails_app/config/boot.rb +++ b/test/rails_app/config/boot.rb @@ -7,9 +7,9 @@ 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? diff --git a/test/test/controller_helpers_test.rb b/test/test/controller_helpers_test.rb index 36f34e99d6..6c5d24ad17 100644 --- a/test/test/controller_helpers_test.rb +++ b/test/test/controller_helpers_test.rb @@ -103,7 +103,7 @@ def respond 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'