summaryrefslogtreecommitdiff
path: root/spec/models/guest_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-05-11 11:19:49 -0700
committerYorick Peterse <yorickpeterse@gmail.com>2018-05-15 14:20:14 +0200
commit3126e89eb811ae76dbb46c122251485361bb69cb (patch)
tree6a79e9756d0a180c0edaf7f306edc2cb5adf1a0f /spec/models/guest_spec.rb
parentf4ef6b474c44eb8e7034034dd95152818ae33b4a (diff)
downloadgitlab-ce-3126e89eb811ae76dbb46c122251485361bb69cb.tar.gz
Add a unique and not null constraint on the project_features.project_id column
This commit has two migrations: 1. The first prunes duplicate rows in the project_features table and leaves the row with the highest ID. Since the behavior was indeterministic before and depended on which row the database decided to use, this change at least makes the permissions consistent. For example, in some cases, the Wiki may have been disabled but enabled in another entry. 2. The second adds a non-null constraint on the project_features.project_id column. Closes #37882 Fixes a significant part of gitlab-com/migration#408. We found that we were overcounting Wikis because of these duplicates. On GitLab.com, there are 56 rows with duplicate entries by project_id, and 16,661 rows with NULL project_id values.
Diffstat (limited to 'spec/models/guest_spec.rb')
-rw-r--r--spec/models/guest_spec.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb
index 2afdd6751a4..fc30f3056e5 100644
--- a/spec/models/guest_spec.rb
+++ b/spec/models/guest_spec.rb
@@ -1,9 +1,9 @@
require 'spec_helper'
describe Guest do
- let(:public_project) { build_stubbed(:project, :public) }
- let(:private_project) { build_stubbed(:project, :private) }
- let(:internal_project) { build_stubbed(:project, :internal) }
+ set(:public_project) { create(:project, :public) }
+ set(:private_project) { create(:project, :private) }
+ set(:internal_project) { create(:project, :internal) }
describe '.can_pull?' do
context 'when project is private' do