diff --git a/Appraisals b/Appraisals index d5231fa1..0540ade6 100644 --- a/Appraisals +++ b/Appraisals @@ -36,9 +36,8 @@ end appraise "ar-6.0" do # >= 6.0.0.beta3 because CVE-2019-5420 - # < rc2 because there seem to have been breaking changes between rc1 and rc2 - # re: MigrationContext - gem "activerecord", [">= 6.0.0.beta3", "< 6.0.0.rc2"] + # <= rc2 because we use private APIs that can change between RCs + gem "activerecord", [">= 6.0.0.beta3", "<= 6.0.0.rc2"] gem "rails-controller-testing", "~> 1.0.3" # Must match `gem` call in active_record/connection_adapters/sqlite3_adapter.rb diff --git a/gemfiles/ar_6.0.gemfile b/gemfiles/ar_6.0.gemfile index 20a5f1fa..c43eafc9 100644 --- a/gemfiles/ar_6.0.gemfile +++ b/gemfiles/ar_6.0.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "activerecord", [">= 6.0.0.beta3", "< 6.0.0.rc2"] +gem "activerecord", [">= 6.0.0.beta3", "<= 6.0.0.rc2"] gem "rails-controller-testing", "~> 1.0.3" gem "sqlite3", "~> 1.4" diff --git a/spec/support/paper_trail_spec_migrator.rb b/spec/support/paper_trail_spec_migrator.rb index b4783bd0..3d5b886b 100644 --- a/spec/support/paper_trail_spec_migrator.rb +++ b/spec/support/paper_trail_spec_migrator.rb @@ -11,7 +11,13 @@ class PaperTrailSpecMigrator # how many people use the programmatic interface? Most people probably # just use rake. Maybe we're doing it wrong. def migrate - if ::ActiveRecord.gem_version >= ::Gem::Version.new("5.2.0.rc1") + v = ::ActiveRecord.gem_version + if v >= ::Gem::Version.new("6.0.0.rc2") + ::ActiveRecord::MigrationContext.new( + @migrations_path, + ::ActiveRecord::Base.connection.schema_migration + ).migrate + elsif ::Gem::Requirement.new([">= 5.2.0.rc1", "< 6.0.0.rc2"]).satisfied_by?(v) ::ActiveRecord::MigrationContext.new(@migrations_path).migrate else ::ActiveRecord::Migrator.migrate(@migrations_path)