summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 51571ddebe9..992c0c29c72 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -92,6 +92,16 @@ RSpec.configure do |config|
Gitlab::Redis.with(&:flushall)
Sidekiq.redis(&:flushall)
end
+
+ config.around(:example, migration: true) do |example|
+ schema_version = example.metadata[:schema]
+ migrations_paths = ActiveRecord::Migrator.migrations_paths
+ ActiveRecord::Migrator.migrate(migrations_paths, schema_version)
+
+ example.run
+
+ ActiveRecord::Migration.maintain_test_schema!
+ end
end
FactoryGirl::SyntaxRunner.class_eval do