Prevent background migration spec from polluting later models
If the schema changes after 20171114162227 for any of these models, and specs after this one use factories, then those factories will use the models with outdated column information cached. We shouldn't really use factories in migration specs, but this is a special case because there is a lot of git-related setup code in the model that would be painful to copy to the migration. Instead, we just manually reset the column information for the models we could pollute.
This commit is contained in:
parent
7951acfd15
commit
9fd6440d4a
1 changed files with 4 additions and 0 deletions
|
@ -15,6 +15,10 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits, :t
|
|||
.to receive(:commits_count=).and_return(nil)
|
||||
end
|
||||
|
||||
after do
|
||||
[Project, MergeRequest, MergeRequestDiff].each(&:reset_column_information)
|
||||
end
|
||||
|
||||
def diffs_to_hashes(diffs)
|
||||
diffs.as_json(only: Gitlab::Git::Diff::SERIALIZE_KEYS).map(&:with_indifferent_access)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue