diff options
author | Sean McGivern <sean@gitlab.com> | 2018-01-16 13:58:07 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-01-16 13:58:07 +0300 |
commit | 9fd6440d4af73c8568ef377032d7416b125a53a2 (patch) | |
tree | 4b4cc759bdb743aaa34c0f68d0e5b455d448d0ae | |
parent | 7951acfd158d3f3b1358acb49925c913c50de3a6 (diff) |
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.
-rw-r--r-- | spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb index 98730602863..d21183b668b 100644 --- a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb +++ b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb @@ -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 |