Skip to content

Commit

Permalink
Merge pull request #5347 from heartcombo/ca-build
Browse files Browse the repository at this point in the history
Support Ruby 3+ officially, remove final Rails 6.1 deprecations, drop test dependency for XML serialization
  • Loading branch information
carlosantoniodasilva authored Feb 16, 2021
2 parents 1bb5fcb + 1ba53dc commit 0cd72a5
Show file tree
Hide file tree
Showing 20 changed files with 171 additions and 239 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- 2.5
- 2.6
- 2.7
- 3.0
env:
- DEVISE_ORM=active_record
- DEVISE_ORM=mongoid
Expand Down Expand Up @@ -59,8 +60,6 @@ jobs:
gemfile: gemfiles/Gemfile-rails-4-2
- ruby: 2.7
gemfile: gemfiles/Gemfile-rails-4-1
- ruby: 2.7
gemfile: gemfiles/Gemfile-rails-4-1
- ruby: 2.7
gemfile: gemfiles/Gemfile-rails-4-2
- ruby: 2.7
Expand All @@ -69,6 +68,16 @@ jobs:
gemfile: gemfiles/Gemfile-rails-5-1
- ruby: 2.7
gemfile: gemfiles/Gemfile-rails-5-2
- ruby: 3.0
gemfile: gemfiles/Gemfile-rails-4-1
- ruby: 3.0
gemfile: gemfiles/Gemfile-rails-4-2
- ruby: 3.0
gemfile: gemfiles/Gemfile-rails-5-0
- ruby: 3.0
gemfile: gemfiles/Gemfile-rails-5-1
- ruby: 3.0
gemfile: gemfiles/Gemfile-rails-5-2
- env: DEVISE_ORM=mongoid
gemfile: Gemfile
- env: DEVISE_ORM=mongoid
Expand All @@ -91,7 +100,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs bundle install and caches installed gems automatically
bundler: ${{ env.BUNDLER_VERSION || 'latest' }}
bundler: ${{ env.BUNDLER_VERSION || '2.2.9' }}
- uses: supercharge/mongodb-github-action@1.3.0
if: ${{ matrix.env == 'DEVISE_ORM=mongoid' }}
- run: bundle exec rake
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Devise now enables the upgrade of OmniAuth 2+. Previously Devise would raise an error if you'd try to upgrade. Please note that OmniAuth 2 is considered a security upgrade and recommended to everyone. You can read more about the details (and possible necessary changes to your app as part of the upgrade) in [their release notes](https://github.com/omniauth/omniauth/releases/tag/v2.0.0). [Devise's OmniAuth Overview wiki](https://github.com/heartcombo/devise/wiki/OmniAuth:-Overview) was also updated to cover OmniAuth 2.0 requirements.
- Note that the upgrade required Devise shared links that initiate the OmniAuth flow to be changed to `method: :post`, which is now a requirement for OmniAuth, part of the security improvement. If you have copied and customized the Devise shared links partial to your app, or if you have other links in your app that initiate the OmniAuth flow, they will have to be updated to use `method: :post`, or changed to use buttons (e.g. `button_to`) to work with OmniAuth 2. (if you're using links with `method: :post`, make sure your app has `rails-ujs` or `jquery-ujs` included in order for these links to work properly.)
- As part of the OmniAuth 2.0 upgrade you might also need to add the [`omniauth-rails_csrf_protection`](https://github.com/cookpad/omniauth-rails_csrf_protection) gem to your app if you don't have it already. (and you don't want to roll your own code to verify requests.) Check the OmniAuth v2 release notes for more info.
* Add support for Ruby 3.
* Add support for Rails 6.1.
* Move CI to GitHub Actions.

* deprecations
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ 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
Expand Down
130 changes: 61 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
GIT
remote: https://github.com/rails/activemodel-serializers-xml.git
revision: 694f4071c6b16e4c8597cc323c241b5f787b3ea8
specs:
activemodel-serializers-xml (1.0.2)
activemodel (>= 5.0.0.a)
activesupport (>= 5.0.0.a)
builder (~> 3.1)

GIT
remote: https://github.com/rails/rails-controller-testing.git
revision: 4b15c86e82ee380f2a7cc009e470368f7520560a
Expand All @@ -29,68 +20,68 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
actioncable (6.1.2.1)
actionpack (= 6.1.2.1)
activesupport (= 6.1.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
actionmailbox (6.1.2.1)
actionpack (= 6.1.2.1)
activejob (= 6.1.2.1)
activerecord (= 6.1.2.1)
activestorage (= 6.1.2.1)
activesupport (= 6.1.2.1)
mail (>= 2.7.1)
actionmailer (6.1.1)
actionpack (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activesupport (= 6.1.1)
actionmailer (6.1.2.1)
actionpack (= 6.1.2.1)
actionview (= 6.1.2.1)
activejob (= 6.1.2.1)
activesupport (= 6.1.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.1)
actionview (= 6.1.1)
activesupport (= 6.1.1)
actionpack (6.1.2.1)
actionview (= 6.1.2.1)
activesupport (= 6.1.2.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.1)
actionpack (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
actiontext (6.1.2.1)
actionpack (= 6.1.2.1)
activerecord (= 6.1.2.1)
activestorage (= 6.1.2.1)
activesupport (= 6.1.2.1)
nokogiri (>= 1.8.5)
actionview (6.1.1)
activesupport (= 6.1.1)
actionview (6.1.2.1)
activesupport (= 6.1.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.1)
activesupport (= 6.1.1)
activejob (6.1.2.1)
activesupport (= 6.1.2.1)
globalid (>= 0.3.6)
activemodel (6.1.1)
activesupport (= 6.1.1)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activestorage (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activesupport (= 6.1.1)
activemodel (6.1.2.1)
activesupport (= 6.1.2.1)
activerecord (6.1.2.1)
activemodel (= 6.1.2.1)
activesupport (= 6.1.2.1)
activestorage (6.1.2.1)
actionpack (= 6.1.2.1)
activejob (= 6.1.2.1)
activerecord (= 6.1.2.1)
activesupport (= 6.1.2.1)
marcel (~> 0.3.1)
mimemagic (~> 0.3.2)
activesupport (6.1.1)
activesupport (6.1.2.1)
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.7)
concurrent-ruby (1.1.8)
crass (1.0.6)
erubi (1.10.0)
faraday (1.3.0)
Expand All @@ -101,7 +92,7 @@ GEM
globalid (0.4.2)
activesupport (>= 4.2.0)
hashie (4.1.0)
i18n (1.8.7)
i18n (1.8.9)
concurrent-ruby (~> 1.0)
jwt (2.2.2)
loofah (2.9.0)
Expand All @@ -120,7 +111,7 @@ GEM
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
nio4r (2.5.4)
nio4r (2.5.5)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
Expand All @@ -130,7 +121,7 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (2.0.1)
omniauth (2.0.2)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
rack-protection
Expand All @@ -152,29 +143,29 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.1)
actioncable (= 6.1.1)
actionmailbox (= 6.1.1)
actionmailer (= 6.1.1)
actionpack (= 6.1.1)
actiontext (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activemodel (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
rails (6.1.2.1)
actioncable (= 6.1.2.1)
actionmailbox (= 6.1.2.1)
actionmailer (= 6.1.2.1)
actionpack (= 6.1.2.1)
actiontext (= 6.1.2.1)
actionview (= 6.1.2.1)
activejob (= 6.1.2.1)
activemodel (= 6.1.2.1)
activerecord (= 6.1.2.1)
activestorage (= 6.1.2.1)
activesupport (= 6.1.2.1)
bundler (>= 1.15.0)
railties (= 6.1.1)
railties (= 6.1.2.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
railties (6.1.2.1)
actionpack (= 6.1.2.1)
activesupport (= 6.1.2.1)
method_source
rake (>= 0.8.7)
thor (~> 1.0)
Expand All @@ -183,6 +174,7 @@ GEM
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rexml (3.2.4)
ruby-openid (2.9.2)
ruby2_keywords (0.0.4)
sprockets (4.0.2)
Expand All @@ -193,8 +185,8 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.4.2)
thor (1.0.1)
timecop (0.9.2)
thor (1.1.0)
timecop (0.9.4)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
warden (1.2.9)
Expand All @@ -212,7 +204,6 @@ PLATFORMS
ruby

DEPENDENCIES
activemodel-serializers-xml!
devise!
mocha (~> 1.1)
omniauth
Expand All @@ -223,6 +214,7 @@ DEPENDENCIES
rails-controller-testing!
rdoc
responders (~> 3.0)
rexml
sqlite3 (~> 1.4)
timecop
webrat (= 0.7.3)
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/Gemfile-rails-5-0
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"

gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"

gem "rails-controller-testing"

gem "responders", "~> 2.1"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/Gemfile-rails-5-1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"

gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"

gem "rails-controller-testing"

gem "responders", "~> 2.1"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/Gemfile-rails-5-2
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"

gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"

gem "rails-controller-testing"

gem "responders", "~> 2.1"
Expand Down
5 changes: 2 additions & 3 deletions gemfiles/Gemfile-rails-6-0
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ source "https://rubygems.org"

gemspec path: ".."

gem "rails", '~> 6.0.0'
gem "rails", '~> 6.0.0', github: 'rails/rails', branch: '6-0-stable'
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
Expand Down
10 changes: 5 additions & 5 deletions test/failure_app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ def call_failure(env_params = {})
end

test 'works for any navigational format' do
swap Devise, navigational_formats: [:xml] do
call_failure('formats' => Mime[:xml])
swap Devise, navigational_formats: [:json] do
call_failure('formats' => Mime[:json])
assert_equal 302, @response.first
end
end
Expand All @@ -236,7 +236,7 @@ def call_failure(env_params = {})

context 'For HTTP request' do
test 'return 401 status' do
call_failure('formats' => Mime[:xml])
call_failure('formats' => Mime[:json])
assert_equal 401, @response.first
end

Expand All @@ -258,13 +258,13 @@ def call_failure(env_params = {})
end

test 'return WWW-authenticate headers if model allows' do
call_failure('formats' => Mime[:xml])
call_failure('formats' => Mime[:json])
assert_equal 'Basic realm="Application"', @response.second["WWW-Authenticate"]
end

test 'does not return WWW-authenticate headers if model does not allow' do
swap Devise, http_authenticatable: false do
call_failure('formats' => Mime[:xml])
call_failure('formats' => Mime[:json])
assert_nil @response.second["WWW-Authenticate"]
end
end
Expand Down
Loading

0 comments on commit 0cd72a5

Please sign in to comment.