Skip to content

A platform for community discussion. Free, open, simple.

DEV: Check for pending migrations before running rspec suite

David Taylorf47909a2b6cf
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 0b58a5ca486..5f8d9f50050 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -176,6 +176,12 @@ RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = true
config.before(:suite) do
+ begin
+ ActiveRecord::Migration.check_pending!
+ rescue ActiveRecord::PendingMigrationError
+ raise "There are pending migrations, run RAILS_ENV=test bin/rake db:migrate"
+ end
+
Sidekiq.error_handlers.clear
# Ugly, but needed until we have a user creator