diff --git a/.travis.yml b/.travis.yml index ecd6dfdb..4ed54c11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: ruby +cache: bundler + rvm: - 2.4.9 - 2.5.7 @@ -6,4 +8,10 @@ rvm: - 2.7.1 gemfile: - - Gemfile + - gemfiles/rails_52.gemfile + - gemfiles/rails_60.gemfile + +jobs: + exclude: + - rvm: 2.4.9 + gemfile: gemfiles/rails_60.gemfile diff --git a/Gemfile b/Gemfile index 9ee5d84f..532fc3ce 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' gem 'pry' -gem 'rails', '~> 5.2.0' +gem 'rails' gem 'rails-controller-testing' -gem 'sqlite3', '~> 1.3.6' +gem 'sqlite3' gemspec diff --git a/gemfiles/rails_52.gemfile b/gemfiles/rails_52.gemfile new file mode 100644 index 00000000..ff1c7211 --- /dev/null +++ b/gemfiles/rails_52.gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 5.2.0' +gem 'rails-controller-testing' +gem 'sqlite3', '~> 1.3.6' + +gemspec path: '..' diff --git a/gemfiles/rails_60.gemfile b/gemfiles/rails_60.gemfile new file mode 100644 index 00000000..cae26b8b --- /dev/null +++ b/gemfiles/rails_60.gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 6.0.0' +gem 'rails-controller-testing' +gem 'sqlite3', '~> 1.4' + +gemspec path: '..' diff --git a/spec/rails_app/app/controllers/application_controller.rb b/spec/rails_app/app/controllers/application_controller.rb new file mode 100644 index 00000000..09705d12 --- /dev/null +++ b/spec/rails_app/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/spec/rails_app/app/controllers/sorcery_controller.rb b/spec/rails_app/app/controllers/sorcery_controller.rb index 1f843c37..94e8e5de 100644 --- a/spec/rails_app/app/controllers/sorcery_controller.rb +++ b/spec/rails_app/app/controllers/sorcery_controller.rb @@ -1,6 +1,6 @@ require 'oauth' -class SorceryController < ActionController::Base +class SorceryController < ApplicationController protect_from_forgery before_action :require_login_from_http_basic, only: [:test_http_basic_auth] diff --git a/spec/support/migration_helper.rb b/spec/support/migration_helper.rb index 27c8f299..5f6e9501 100644 --- a/spec/support/migration_helper.rb +++ b/spec/support/migration_helper.rb @@ -1,7 +1,9 @@ class MigrationHelper class << self def migrate(path) - if ActiveRecord.version >= Gem::Version.new('5.2.0') + if ActiveRecord.version >= Gem::Version.new('6.0.0') + ActiveRecord::MigrationContext.new(path, schema_migration).migrate + elsif ActiveRecord.version >= Gem::Version.new('5.2.0') ActiveRecord::MigrationContext.new(path).migrate else ActiveRecord::Migrator.migrate(path) @@ -9,11 +11,19 @@ def migrate(path) end def rollback(path) - if ActiveRecord.version >= Gem::Version.new('5.2.0') + if ActiveRecord.version >= Gem::Version.new('6.0.0') + ActiveRecord::MigrationContext.new(path, schema_migration).rollback + elsif ActiveRecord.version >= Gem::Version.new('5.2.0') ActiveRecord::MigrationContext.new(path).rollback else ActiveRecord::Migrator.rollback(path) end end + + private + + def schema_migration + ActiveRecord::Base.connection.schema_migration + end end end