diff options
Diffstat (limited to 'spec/migrations/migrate_pipeline_stages_spec.rb')
-rw-r--r-- | spec/migrations/migrate_pipeline_stages_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/migrations/migrate_pipeline_stages_spec.rb b/spec/migrations/migrate_pipeline_stages_spec.rb index 038e5d7fc6b..d6d26ab52ad 100644 --- a/spec/migrations/migrate_pipeline_stages_spec.rb +++ b/spec/migrations/migrate_pipeline_stages_spec.rb @@ -2,10 +2,23 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20170525132202_migrate_pipeline_stages.rb') describe MigratePipelineStages, :migration, schema: 20170523091700 do + ## + # TODO, extract to migrations helper + # 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 + ## # Create test data # @@ -13,10 +26,10 @@ describe MigratePipelineStages, :migration, schema: 20170523091700 do table(:ci_pipelines).create!(ref: 'master', sha: 'adf43c3a') end - it 'correctly migrates pipeline stages' do + it 'correctly migrates pipeline stages' do |migration, meta| expect(ActiveRecord::Base.connection.table_exists?('ci_stages')).to eq false - described_class.new.migrate(:up) + migrate! expect(ActiveRecord::Base.connection.table_exists?('ci_stages')).to eq true end |