Commit 8286a3d8 authored by Stan Hu's avatar Stan Hu

Fix order-dependent migration specs

CleanupOptimisticLockingNulls and CleanupOptimisticLockingNullsPt2 both
defined the constant TABLES, which caused the tests to fail if they were
run together. To fix this, we drop the constant and use straight
definitions.
parent 3178a722
...@@ -4,11 +4,10 @@ require 'spec_helper' ...@@ -4,11 +4,10 @@ require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20200217210353_cleanup_optimistic_locking_nulls_pt2') require Rails.root.join('db', 'post_migrate', '20200217210353_cleanup_optimistic_locking_nulls_pt2')
describe CleanupOptimisticLockingNullsPt2, :migration do describe CleanupOptimisticLockingNullsPt2, :migration do
TABLES = %w(ci_stages ci_builds ci_pipelines).freeze let(:ci_stages) { table(:ci_stages) }
TABLES.each do |table| let(:ci_builds) { table(:ci_builds) }
let(table.to_sym) { table(table.to_sym) } let(:ci_pipelines) { table(:ci_pipelines) }
end let(:tables) { [ci_stages, ci_builds, ci_pipelines] }
let(:tables) { TABLES.map { |t| method(t.to_sym).call } }
before do before do
# Create necessary rows # Create necessary rows
......
...@@ -4,11 +4,10 @@ require 'spec_helper' ...@@ -4,11 +4,10 @@ require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20200128210353_cleanup_optimistic_locking_nulls') require Rails.root.join('db', 'post_migrate', '20200128210353_cleanup_optimistic_locking_nulls')
describe CleanupOptimisticLockingNulls do describe CleanupOptimisticLockingNulls do
TABLES = %w(epics merge_requests issues).freeze let(:epics) { table(:epics) }
TABLES.each do |table| let(:merge_requests) { table(:merge_requests) }
let(table.to_sym) { table(table.to_sym) } let(:issues) { table(:issues) }
end let(:tables) { [epics, merge_requests, issues] }
let(:tables) { TABLES.map { |t| method(t.to_sym).call } }
let(:namespaces) { table(:namespaces) } let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) } let(:projects) { table(:projects) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment