Merge branch 'ca-rails-main'

Add Rails 7 / main support
This commit is contained in:
Carlos Antonio da Silva 2021-10-07 20:23:21 -03:00
commit bb879f7154
12 changed files with 197 additions and 89 deletions

View File

@ -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,44 @@ 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.5
gemfile: Gemfile
- ruby: 2.6
gemfile: gemfiles/Gemfile-rails-4-1
- ruby: 2.6
gemfile: gemfiles/Gemfile-rails-4-2
- ruby: 2.6
gemfile: Gemfile
- ruby: 2.6
gemfile: gemfiles/Gemfile-rails-main
- ruby: 2.7
gemfile: gemfiles/Gemfile-rails-4-1
- ruby: 2.7
@ -88,6 +114,12 @@ 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: Gemfile
- 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 }}

View File

@ -1,5 +1,8 @@
### unreleased
* enhancements
* Add support for Rails 7.0 alpha 2.
### 4.8.0 - 2021-04-29
* enhancements

View File

@ -4,7 +4,7 @@ source "https://rubygems.org"
gemspec
gem "rails", "~> 6.1.0"
gem "rails", "~> 7.0.0.alpha2"
gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"

View File

@ -20,102 +20,111 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.3.2)
actionpack (= 6.1.3.2)
activesupport (= 6.1.3.2)
actioncable (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.3.2)
actionpack (= 6.1.3.2)
activejob (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
actionmailbox (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activestorage (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
mail (>= 2.7.1)
actionmailer (6.1.3.2)
actionpack (= 6.1.3.2)
actionview (= 6.1.3.2)
activejob (= 6.1.3.2)
activesupport (= 6.1.3.2)
actionmailer (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
actionview (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.3.2)
actionview (= 6.1.3.2)
activesupport (= 6.1.3.2)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.0.alpha2)
actionview (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.3.2)
actionpack (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
actiontext (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activestorage (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
nokogiri (>= 1.8.5)
actionview (6.1.3.2)
activesupport (= 6.1.3.2)
actionview (7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.3.2)
activesupport (= 6.1.3.2)
activejob (7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
globalid (>= 0.3.6)
activemodel (6.1.3.2)
activesupport (= 6.1.3.2)
activerecord (6.1.3.2)
activemodel (= 6.1.3.2)
activesupport (= 6.1.3.2)
activestorage (6.1.3.2)
actionpack (= 6.1.3.2)
activejob (= 6.1.3.2)
activerecord (= 6.1.3.2)
activesupport (= 6.1.3.2)
activemodel (7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
activerecord (7.0.0.alpha2)
activemodel (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
activestorage (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
marcel (~> 1.0.0)
mini_mime (~> 1.0.2)
activesupport (6.1.3.2)
mini_mime (>= 1.1.0)
activesupport (7.0.0.alpha2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
bcrypt (3.1.16)
builder (3.2.4)
concurrent-ruby (1.1.8)
concurrent-ruby (1.1.9)
crass (1.0.6)
erubi (1.10.0)
faraday (1.4.1)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.1.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
globalid (0.5.2)
activesupport (>= 5.0)
hashie (4.1.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jwt (2.2.3)
loofah (2.9.1)
jwt (2.3.0)
loofah (2.12.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.1)
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.0.3)
mini_portile2 (2.5.1)
mini_mime (1.1.1)
mini_portile2 (2.6.1)
minitest (5.14.4)
mocha (1.12.0)
mocha (1.13.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
nio4r (2.5.7)
nokogiri (1.11.3)
mini_portile2 (~> 2.5.0)
nio4r (2.5.8)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
@ -145,40 +154,41 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.3.2)
actioncable (= 6.1.3.2)
actionmailbox (= 6.1.3.2)
actionmailer (= 6.1.3.2)
actionpack (= 6.1.3.2)
actiontext (= 6.1.3.2)
actionview (= 6.1.3.2)
activejob (= 6.1.3.2)
activemodel (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
rails (7.0.0.alpha2)
actioncable (= 7.0.0.alpha2)
actionmailbox (= 7.0.0.alpha2)
actionmailer (= 7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
actiontext (= 7.0.0.alpha2)
actionview (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activemodel (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activestorage (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
bundler (>= 1.15.0)
railties (= 6.1.3.2)
railties (= 7.0.0.alpha2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.1.3.2)
actionpack (= 6.1.3.2)
activesupport (= 6.1.3.2)
railties (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
method_source
rake (>= 0.8.7)
rake (>= 0.13)
thor (~> 1.0)
rake (13.0.3)
rdoc (6.3.1)
zeitwerk (~> 2.5.0.beta3)
rake (13.0.6)
rdoc (6.3.2)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rexml (3.2.5)
ruby-openid (2.9.2)
ruby2_keywords (0.0.4)
ruby2_keywords (0.0.5)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
@ -197,10 +207,10 @@ GEM
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
websocket-driver (0.7.3)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.4.2)
zeitwerk (2.5.0.beta5)
PLATFORMS
ruby
@ -212,7 +222,7 @@ DEPENDENCIES
omniauth-facebook
omniauth-oauth2
omniauth-openid
rails (~> 6.1.0)
rails (~> 7.0.0.alpha2)
rails-controller-testing!
rdoc
responders (~> 3.0)
@ -222,4 +232,4 @@ DEPENDENCIES
webrat (= 0.7.3)
BUNDLED WITH
2.2.7
2.2.28

View 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

View 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

View File

@ -313,12 +313,14 @@ module Devise
end
def get
ActiveSupport::Dependencies.constantize(@name)
@name.constantize
end
end
def self.ref(arg)
ActiveSupport::Dependencies.reference(arg)
if ActiveSupport::Dependencies.respond_to?(:reference)
ActiveSupport::Dependencies.reference(arg)
end
Getter.new(arg)
end

View File

@ -79,7 +79,6 @@ class FailureTest < ActiveSupport::TestCase
'HTTP_HOST' => 'test.host',
'REQUEST_METHOD' => 'GET',
'warden.options' => { scope: :user },
'rack.session' => {},
'action_dispatch.request.formats' => Array(env_params.delete('formats') || Mime[:html]),
'rack.input' => "",
'warden' => OpenStruct.new(message: nil)

View File

@ -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

View File

@ -46,8 +46,12 @@ 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
if Devise::Test.rails7_and_up?
config.active_record.legacy_connection_handling = false
end
end
end

View File

@ -7,9 +7,13 @@ end
module Devise
module Test
# Detection for minor differences between Rails versions in tests.
def self.rails6?
Rails.version.start_with? '6'
def self.rails7_and_up?
Rails::VERSION::MAJOR >= 7
end
def self.rails6_and_up?
Rails::VERSION::MAJOR >= 6
end
def self.rails52_and_up?

View File

@ -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'