summaryrefslogtreecommitdiff
path: root/spec/models/namespace_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 09:09:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 09:09:13 +0000
commit1ac794623a8be5dee111716a44dd04ff708f3541 (patch)
tree6c18f9fbe0bd9978bd3e8d9b083d3a0ca180686e /spec/models/namespace_spec.rb
parent5247fe0bef72fa922841a79d5dbefb47d95112fa (diff)
downloadgitlab-ce-1ac794623a8be5dee111716a44dd04ff708f3541.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 740385bbd54..54e54366c5a 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -983,6 +983,24 @@ describe Namespace do
expect(virtual_domain.lookup_paths).not_to be_empty
end
end
+
+ it 'preloads project_feature and route' do
+ project2 = create(:project, namespace: namespace)
+ project3 = create(:project, namespace: namespace)
+
+ project.mark_pages_as_deployed
+ project2.mark_pages_as_deployed
+ project3.mark_pages_as_deployed
+
+ virtual_domain = namespace.pages_virtual_domain
+
+ queries = ActiveRecord::QueryRecorder.new { virtual_domain.lookup_paths }
+
+ # 1 to load projects
+ # 1 to preload project features
+ # 1 to load routes
+ expect(queries.count).to eq(3)
+ end
end
end