diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-05 13:28:02 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-05 13:28:02 +0100 |
commit | 3138fcdcd70fd30fea74deff537b9836d6c94d21 (patch) | |
tree | 4dd734b6e853595e0cf9f8e0df87df7012e33d42 /spec/controllers | |
parent | 445a41091b45e593b02626f2bd4c34621c0021f7 (diff) | |
parent | 9f75b7a47fbfe352f7b099769861b1cc0a9617eb (diff) | |
download | gitlab-ce-3138fcdcd70fd30fea74deff537b9836d6c94d21.tar.gz |
Merge remote-tracking branch 'origin/master' into 35616-move-k8-to-cluster-page
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index e7ab714c550..e4b2bbb7c51 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -261,6 +261,27 @@ describe ProjectsController do expect(response).to redirect_to(namespace_project_path) end end + + context 'when the project is forked and has a repository', :request_store do + let(:public_project) { create(:project, :public, :repository) } + let(:other_user) { create(:user) } + + render_views + + before do + # View the project as a user that does not have any rights + sign_in(other_user) + + fork_project(public_project) + end + + it 'does not increase the number of queries when the project is forked' do + expected_query = /#{public_project.fork_network.find_forks_in(other_user.namespace).to_sql}/ + + expect { get(:show, namespace_id: public_project.namespace, id: public_project) } + .not_to exceed_query_limit(1).for_query(expected_query) + end + end end describe "#update" do |