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/projects/branches_spec.rb
parentce5d1b6fd7ed1aea2d2a675414ba81be624f2bf1 (diff)
removes n+1 query from tags and branches indexes
Diffstat (limited to 'spec/features/projects/branches_spec.rb')
-rw-r--r--spec/features/projects/branches_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb
index d26a0caf036..8e0306ce83b 100644
--- a/spec/features/projects/branches_spec.rb
+++ b/spec/features/projects/branches_spec.rb
@@ -17,6 +17,14 @@ describe 'Branches', feature: true do
repository.branches { |branch| expect(page).to have_content("#{branch.name}") }
expect(page).to have_content("Protected branches can be managed in project settings")
end
+
+ it 'avoids a N+1 query in branches index' do
+ control_count = ActiveRecord::QueryRecorder.new { visit namespace_project_branches_path(project.namespace, project) }.count
+
+ %w(one two three four five).each { |ref| repository.add_branch(@user, ref, 'master') }
+
+ expect { visit namespace_project_branches_path(project.namespace, project) }.not_to exceed_query_limit(control_count)
+ end
end
describe 'Find branches' do