Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-25 23:43:16 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-25 23:43:16 +0300
commitacc22a8422cd1471819510aa375c455b5ea009c5 (patch)
tree1f6d830aa5fb3407c1ce86435d579626caf13b1c /spec/spec_helper.rb
parent6d8963e33657b80821900a60f66d0a51416dc59a (diff)
Simplify migrations for specific database schema
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