summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-01-16 10:58:07 +0000
committerSean McGivern <sean@gitlab.com>2018-01-16 10:58:07 +0000
commit9fd6440d4af73c8568ef377032d7416b125a53a2 (patch)
tree4b4cc759bdb743aaa34c0f68d0e5b455d448d0ae
parent7951acfd158d3f3b1358acb49925c913c50de3a6 (diff)
downloadgitlab-ce-9fd6440d4af73c8568ef377032d7416b125a53a2.tar.gz
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.rb4
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