test/test_helper.rb in derailed_benchmarks-1.4.0 vs test/test_helper.rb in derailed_benchmarks-1.4.1
- old
+ new
@@ -27,18 +27,21 @@
require "capybara/rails"
Capybara.default_driver = :rack_test
Capybara.default_selector = :css
require_relative "rails_app/config/environment"
-ActiveRecord::Migrator.migrations_paths = [File.expand_path("../rails_app/db/migrate", __dir__)]
-if Rails.gem_version >= Gem::Version.new('5.2.0')
- ActiveRecord::MigrationContext
- .new(File.expand_path("../rails_app/db/migrate/", __FILE__))
- .migrate
+# 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'
+ ActiveRecord::MigrationContext.new(migrate_path).migrate
else
- ActiveRecord::Migrator.migrate(File.expand_path("../rails_app/db/migrate/", __FILE__))
+ ActiveRecord::Migrator.migrate(migrate_path)
end
+
+ActiveRecord::Migration.maintain_test_schema!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
class ActiveSupport::IntegrationCase