Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2017-03-13 19:00:07 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2017-03-16 22:41:03 +0300
commit26d3da4bfe5c4718d3dfb4407cee58da53b408aa (patch)
treeb3252b0ff91763b3bc7f798ac329dc0e2f05375b /spec/features/tags
parentce5d1b6fd7ed1aea2d2a675414ba81be624f2bf1 (diff)
removes n+1 query from tags and branches indexes
Diffstat (limited to 'spec/features/tags')
-rw-r--r--spec/features/tags/master_views_tags_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/master_views_tags_spec.rb
index 29d2c244720..555f84c4772 100644
--- a/spec/features/tags/master_views_tags_spec.rb
+++ b/spec/features/tags/master_views_tags_spec.rb
@@ -27,10 +27,20 @@ feature 'Master views tags', feature: true do
context 'when project has tags' do
let(:project) { create(:project, namespace: user.namespace) }
+ let(:repository) { project.repository }
+
before do
visit namespace_project_tags_path(project.namespace, project)
end
+ scenario 'avoids a N+1 query in branches index' do
+ control_count = ActiveRecord::QueryRecorder.new { visit namespace_project_tags_path(project.namespace, project) }.count
+
+ %w(one two three four five).each { |tag| repository.add_tag(user, tag, 'master', 'foo') }
+
+ expect { visit namespace_project_tags_path(project.namespace, project) }.not_to exceed_query_limit(control_count)
+ end
+
scenario 'views the tags list page' do
expect(page).to have_content 'v1.0.0'
end