From a46ffb8a1f23aabef0d003dd3c632315373a38b6 Mon Sep 17 00:00:00 2001 From: Deepak Mahakale Date: Tue, 13 Sep 2022 09:38:43 +0530 Subject: [PATCH] Add rails 7.0 to CI (#293) Add 7.0 to Appraisal Fix issue in the test helper for rails 7 --- .github/workflows/ci.yml | 10 +++++----- Appraisals | 10 +++++----- gemfiles/rails_5.2.gemfile | 2 +- test/test_helper.rb | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19a0564..57710b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,13 +20,13 @@ jobs: gemfile: - gemfiles/rails_5.2.gemfile - gemfiles/rails_6.0.gemfile - # - gemfiles/rails_7.0.gemfile + - gemfiles/rails_7.0.gemfile # - gemfile: gemfiles/rails_head.gemfile exclude: - # - ruby: '2.5' - # gemfile: gemfiles/rails_7.0.gemfile - # - ruby: '2.6' - # gemfile: gemfiles/rails_7.0.gemfile + - ruby: '2.5' + gemfile: gemfiles/rails_7.0.gemfile + - ruby: '2.6' + gemfile: gemfiles/rails_7.0.gemfile - ruby: '2.7' gemfile: gemfiles/rails_5.2.gemfile - ruby: '3.0' diff --git a/Appraisals b/Appraisals index 7aa4609..e8b5fee 100644 --- a/Appraisals +++ b/Appraisals @@ -1,11 +1,11 @@ -appraise "rails-5.1" do +appraise "rails-5.2" do gem "rails", "~> 5.2" end -appraise "rails-5.2" do - gem "rails", "~> 5.2" +appraise "rails-6.0" do + gem "rails", "~> 6.0" end -appraise "rails-6.0.1" do - gem "rails", "~> 6.0.1" +appraise "rails-7.0" do + gem "rails", "~> 7.0" end diff --git a/gemfiles/rails_5.2.gemfile b/gemfiles/rails_5.2.gemfile index 45509cf..56b28a7 100644 --- a/gemfiles/rails_5.2.gemfile +++ b/gemfiles/rails_5.2.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", "~> 5.2.0" +gem "rails", "~> 5.2" group :development, :test do gem "sqlite3", platform: [:ruby, :mswin, :mingw] diff --git a/test/test_helper.rb b/test/test_helper.rb index bb164ae..362117a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -18,12 +18,12 @@ # https://github.com/plataformatec/devise/blob/master/test/orm/active_record.rb migrate_path = File.expand_path("../rails_app/db/migrate", __FILE__) -if Rails.version.start_with? '6' - ActiveRecord::MigrationContext.new(migrate_path, ActiveRecord::SchemaMigration).migrate -elsif Rails.version.start_with? '5.2' +if ActiveRecord.version < Gem::Version.create("5.2.0") + ActiveRecord::Migrator.migrate(migrate_path) +elsif ActiveRecord.version < Gem::Version.create("6.0.0") ActiveRecord::MigrationContext.new(migrate_path).migrate else - ActiveRecord::Migrator.migrate(migrate_path) + ActiveRecord::MigrationContext.new(migrate_path, ActiveRecord::SchemaMigration).migrate end # Load support files