From a45bbe1783e4b46af15825a0bb2eb5917a9b8726 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Thu, 22 Feb 2018 07:05:19 -0600 Subject: [PATCH] Test on Rails 5.2.0.rc1 (#4711) --- .travis.yml | 5 + gemfiles/Gemfile.rails-5.2-rc1 | 26 ++++ gemfiles/Gemfile.rails-5.2-rc1.lock | 201 ++++++++++++++++++++++++++ test/integration/rememberable_test.rb | 2 +- test/orm/active_record.rb | 7 +- test/rails_app/config/application.rb | 6 +- test/rails_app/config/boot.rb | 7 +- test/test/controller_helpers_test.rb | 2 +- 8 files changed, 250 insertions(+), 6 deletions(-) create mode 100644 gemfiles/Gemfile.rails-5.2-rc1 create mode 100644 gemfiles/Gemfile.rails-5.2-rc1.lock diff --git a/.travis.yml b/.travis.yml index 1dd682d4..bc96039e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rvm: gemfile: - Gemfile + - gemfiles/Gemfile.rails-5.2-rc1 - gemfiles/Gemfile.rails-5.0-stable - gemfiles/Gemfile.rails-4.2-stable - gemfiles/Gemfile.rails-4.1-stable @@ -18,6 +19,8 @@ matrix: exclude: - rvm: 2.1.10 gemfile: Gemfile + - rvm: 2.1.10 + gemfile: gemfiles/Gemfile.rails-5.2-rc1 - rvm: 2.5.0 gemfile: gemfiles/Gemfile.rails-4.1-stable - rvm: 2.4.2 @@ -32,6 +35,8 @@ matrix: gemfile: Gemfile - env: DEVISE_ORM=mongoid gemfile: gemfiles/Gemfile.rails-5.0-stable + - env: DEVISE_ORM=mongoid + gemfile: gemfiles/Gemfile.rails-5.2-rc1 allow_failures: - rvm: ruby-head services: diff --git a/gemfiles/Gemfile.rails-5.2-rc1 b/gemfiles/Gemfile.rails-5.2-rc1 new file mode 100644 index 00000000..2853e188 --- /dev/null +++ b/gemfiles/Gemfile.rails-5.2-rc1 @@ -0,0 +1,26 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem "rails", '~> 5.2.0.rc1' +gem "omniauth" +gem "omniauth-oauth2" +gem "rdoc" + +gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml" + +gem "rails-controller-testing" + +gem "responders", "~> 2.1" + +group :test do + gem "omniauth-facebook" + gem "omniauth-openid" + gem "webrat", "0.7.3", require: false + gem "mocha", "~> 1.1", require: false + gem 'test_after_commit', require: false +end + +platforms :ruby do + gem "sqlite3" +end diff --git a/gemfiles/Gemfile.rails-5.2-rc1.lock b/gemfiles/Gemfile.rails-5.2-rc1.lock new file mode 100644 index 00000000..b29a2819 --- /dev/null +++ b/gemfiles/Gemfile.rails-5.2-rc1.lock @@ -0,0 +1,201 @@ +GIT + remote: git://github.com/rails/activemodel-serializers-xml.git + revision: 356edf4dfc38fb1fbfee90c87856e4fe5b73c5e1 + specs: + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) + builder (~> 3.1) + +PATH + remote: .. + specs: + devise (4.4.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 5.2) + responders + warden (~> 1.2.3) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + actionview (= 5.2.0.rc1) + activejob (= 5.2.0.rc1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.0.rc1) + actionview (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.0.rc1) + activesupport (= 5.2.0.rc1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.0.rc1) + activesupport (= 5.2.0.rc1) + globalid (>= 0.3.6) + activemodel (5.2.0.rc1) + activesupport (= 5.2.0.rc1) + activerecord (5.2.0.rc1) + activemodel (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + arel (>= 9.0) + activestorage (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + activerecord (= 5.2.0.rc1) + marcel (~> 0.3.1) + activesupport (5.2.0.rc1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + bcrypt (3.1.11) + builder (3.2.3) + concurrent-ruby (1.0.5) + crass (1.0.3) + erubi (1.7.0) + faraday (0.12.2) + multipart-post (>= 1.2, < 3) + globalid (0.4.1) + activesupport (>= 4.2.0) + hashie (3.5.7) + i18n (0.9.3) + concurrent-ruby (~> 1.0) + jwt (1.5.6) + loofah (2.1.1) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.0) + mini_mime (>= 0.1.1) + marcel (0.3.1) + mimemagic (~> 0.3.2) + metaclass (0.0.4) + method_source (0.9.0) + mimemagic (0.3.2) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.11.3) + mocha (1.3.0) + metaclass (~> 0.0.1) + multi_json (1.13.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nio4r (2.2.0) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + oauth2 (1.4.0) + faraday (>= 0.8, < 0.13) + jwt (~> 1.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) + omniauth (1.8.1) + hashie (>= 3.4.6, < 3.6.0) + rack (>= 1.6.2, < 3) + omniauth-facebook (4.0.0) + omniauth-oauth2 (~> 1.2) + omniauth-oauth2 (1.5.0) + oauth2 (~> 1.1) + omniauth (~> 1.2) + omniauth-openid (1.0.1) + omniauth (~> 1.0) + rack-openid (~> 1.3.1) + orm_adapter (0.5.0) + rack (2.0.4) + rack-openid (1.3.1) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) + rack-test (0.8.2) + rack (>= 1.0, < 3) + rails (5.2.0.rc1) + actioncable (= 5.2.0.rc1) + actionmailer (= 5.2.0.rc1) + actionpack (= 5.2.0.rc1) + actionview (= 5.2.0.rc1) + activejob (= 5.2.0.rc1) + activemodel (= 5.2.0.rc1) + activerecord (= 5.2.0.rc1) + activestorage (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + bundler (>= 1.3.0) + railties (= 5.2.0.rc1) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.2) + actionpack (~> 5.x, >= 5.0.1) + actionview (~> 5.x, >= 5.0.1) + activesupport (~> 5.x) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.0) + rdoc (6.0.1) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + ruby-openid (2.7.0) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + test_after_commit (1.1.0) + activerecord (>= 3.2) + thor (0.20.0) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + warden (1.2.7) + rack (>= 1.0) + webrat (0.7.3) + nokogiri (>= 1.2.0) + rack (>= 1.0) + rack-test (>= 0.5.3) + websocket-driver (0.7.0) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + activemodel-serializers-xml! + devise! + mocha (~> 1.1) + omniauth + omniauth-facebook + omniauth-oauth2 + omniauth-openid + rails (~> 5.2.0.rc1) + rails-controller-testing + rdoc + responders (~> 2.1) + sqlite3 + test_after_commit + webrat (= 0.7.3) + +BUNDLED WITH + 1.16.0 diff --git a/test/integration/rememberable_test.rb b/test/integration/rememberable_test.rb index 193a458e..a85e66a0 100644 --- a/test/integration/rememberable_test.rb +++ b/test/integration/rememberable_test.rb @@ -12,7 +12,7 @@ class RememberMeTest < Devise::IntegrationTest end def generate_signed_cookie(raw_cookie) - request = if Devise::Test.rails51? + request = if Devise::Test.rails51? || Devise::Test.rails52? ActionController::TestRequest.create(Class.new) # needs a "controller class" elsif Devise::Test.rails5? ActionController::TestRequest.create diff --git a/test/orm/active_record.rb b/test/orm/active_record.rb index 138c554c..1aec0cad 100644 --- a/test/orm/active_record.rb +++ b/test/orm/active_record.rb @@ -4,7 +4,12 @@ ActiveRecord::Migration.verbose = false ActiveRecord::Base.logger = Logger.new(nil) ActiveRecord::Base.include_root_in_json = true -ActiveRecord::Migrator.migrate(File.expand_path("../../rails_app/db/migrate/", __FILE__)) +migrate_path = File.expand_path("../../rails_app/db/migrate/", __FILE__) +if Devise::Test.rails52? + ActiveRecord::MigrationContext.new(migrate_path).migrate +else + ActiveRecord::Migrator.migrate(migrate_path) +end class ActiveSupport::TestCase if Devise::Test.rails5? diff --git a/test/rails_app/config/application.rb b/test/rails_app/config/application.rb index 19f44e41..6d4606d6 100644 --- a/test/rails_app/config/application.rb +++ b/test/rails_app/config/application.rb @@ -33,8 +33,10 @@ module RailsApp # config.assets.enabled = false config.action_mailer.default_url_options = { host: "localhost", port: 3000 } - - if DEVISE_ORM == :active_record && (Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 2) + rails_version = Gem::Version.new(Rails.version) + if DEVISE_ORM == :active_record && + rails_version >= Gem::Version.new('4.2.0') && + rails_version < Gem::Version.new('5.1.0') config.active_record.raise_in_transactional_callbacks = true end diff --git a/test/rails_app/config/boot.rb b/test/rails_app/config/boot.rb index 07fe8daa..38d770f1 100644 --- a/test/rails_app/config/boot.rb +++ b/test/rails_app/config/boot.rb @@ -6,7 +6,12 @@ end module Devise module Test - # Detection for minor differences between Rails 4 and 5, and 5.1 in tests. + # Detection for minor differences between Rails 4 and 5, 5.1, and 5.2 in tests. + + def self.rails52? + Rails.version.start_with? '5.2' + end + def self.rails51? Rails.version.start_with? '5.1' end diff --git a/test/test/controller_helpers_test.rb b/test/test/controller_helpers_test.rb index 6c14c189..5ca59f3c 100644 --- a/test/test/controller_helpers_test.rb +++ b/test/test/controller_helpers_test.rb @@ -166,7 +166,7 @@ class TestControllerHelpersTest < Devise::ControllerTestCase test "creates a new warden proxy if the request object has changed" do old_warden_proxy = warden - @request = if Devise::Test.rails51? + @request = if Devise::Test.rails51? || Devise::Test.rails52? ActionController::TestRequest.create(Class.new) # needs a "controller class" elsif Devise::Test.rails5? ActionController::TestRequest.create