diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 09:09:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 09:09:13 +0000 |
commit | 1ac794623a8be5dee111716a44dd04ff708f3541 (patch) | |
tree | 6c18f9fbe0bd9978bd3e8d9b083d3a0ca180686e /spec/models/namespace_spec.rb | |
parent | 5247fe0bef72fa922841a79d5dbefb47d95112fa (diff) | |
download | gitlab-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.rb | 18 |
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 |