diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2016-10-28 11:31:45 +0200 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2016-10-28 11:31:45 +0200 |
commit | e2c603696a9647c15cd154156f13d0e203a930f1 (patch) | |
tree | 22f64b82526f74fabb9009db8f6932c4e8d74d12 /spec/controllers/projects/labels_controller_spec.rb | |
parent | 20a7db4483904c7280093a0309a63dfd1b7ef72e (diff) | |
download | gitlab-ce-e2c603696a9647c15cd154156f13d0e203a930f1.tar.gz |
Pass user instance to Labels::FindOrCreateService or skip_authorization: trueadam-fix-labels-find-or-create
Do not pass project.owner because it may return a group and Labels::FindOrCreateService
throws an error in this case.
Fixes #23694.
Diffstat (limited to 'spec/controllers/projects/labels_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/labels_controller_spec.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/controllers/projects/labels_controller_spec.rb b/spec/controllers/projects/labels_controller_spec.rb index 41df63d445a..8faecec0063 100644 --- a/spec/controllers/projects/labels_controller_spec.rb +++ b/spec/controllers/projects/labels_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Projects::LabelsController do let(:group) { create(:group) } - let(:project) { create(:project, namespace: group) } + let(:project) { create(:empty_project, namespace: group) } let(:user) { create(:user) } before do @@ -73,16 +73,27 @@ describe Projects::LabelsController do describe 'POST #generate' do let(:admin) { create(:admin) } - let(:project) { create(:empty_project) } before do sign_in(admin) end - it 'creates labels' do - post :generate, namespace_id: project.namespace.to_param, project_id: project.to_param + context 'personal project' do + let(:personal_project) { create(:empty_project) } - expect(response).to have_http_status(302) + it 'creates labels' do + post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project.to_param + + expect(response).to have_http_status(302) + end + end + + context 'project belonging to a group' do + it 'creates labels' do + post :generate, namespace_id: project.namespace.to_param, project_id: project.to_param + + expect(response).to have_http_status(302) + end end end end |