diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 09:07:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 09:07:48 +0000 |
commit | 5bd24a54ef4ce3a38a860eb53b66d062c2382971 (patch) | |
tree | 5f5e65571dfcb2c62c27600ee7655dec4b44c923 /spec/requests/projects | |
parent | 74673d04d25ffed35cbcf17cd42969bed0a4e705 (diff) | |
download | gitlab-ce-5bd24a54ef4ce3a38a860eb53b66d062c2382971.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/projects')
-rw-r--r-- | spec/requests/projects/merge_requests/creations_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/requests/projects/merge_requests/creations_spec.rb b/spec/requests/projects/merge_requests/creations_spec.rb new file mode 100644 index 00000000000..d192e1bca7f --- /dev/null +++ b/spec/requests/projects/merge_requests/creations_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'merge requests creations' do + describe 'GET /:namespace/:project/merge_requests/new' do + include ProjectForksHelper + + let(:project) { create(:project, :repository) } + let(:user) { project.owner } + + before do + login_as(user) + end + + def get_new + get namespace_project_new_merge_request_path(namespace_id: project.namespace, project_id: project) + end + + it 'avoids N+1 DB queries even with forked projects' do + control = ActiveRecord::QueryRecorder.new(skip_cached: false) { get_new } + + 5.times { fork_project(project, user) } + + expect { get_new }.not_to exceed_query_limit(control) + end + end +end |