diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-26 10:36:01 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-26 10:36:01 +0200 |
commit | 0f9fbae78a51f7bf4df50d96060087e1cf903b05 (patch) | |
tree | 0563abb70a86704aa29c2ddfc5abf87de94684f4 /spec/support | |
parent | f7aba153164618522232c912eb833bd7596f5f53 (diff) | |
download | gitlab-ce-0f9fbae78a51f7bf4df50d96060087e1cf903b05.tar.gz |
Add migrations helpers to simplify writing migration specs
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/migrations_helpers.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/migrations_helpers.rb b/spec/support/migrations_helpers.rb new file mode 100644 index 00000000000..965b00b5731 --- /dev/null +++ b/spec/support/migrations_helpers.rb @@ -0,0 +1,15 @@ +module MigrationsHelpers + def table(name) + Class.new(ActiveRecord::Base) { self.table_name = name } + end + + def migrations_paths + ActiveRecord::Migrator.migrations_paths + end + + def migrate! + ActiveRecord::Migrator.up(migrations_paths) do |migration| + migration.name == described_class.name + end + end +end |