diff options
author | Małgorzata Ksionek <meksionek@gmail.com> | 2019-02-12 15:29:47 +0300 |
---|---|---|
committer | Małgorzata Ksionek <meksionek@gmail.com> | 2019-02-20 16:13:36 +0300 |
commit | d2c83f40498fc76388779cd3f42f9c6ea6fed555 (patch) | |
tree | 834048d414a6bfd96a9c31bb86183e74f62098ef /spec/requests/api | |
parent | 902e4f63d6fffe782757bcc3c6c0963e02250eb1 (diff) |
Change policy regarding group visibility
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index cfa7a1a31a3..feff53ebc25 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1484,6 +1484,9 @@ describe API::Projects do describe "POST /projects/:id/share" do let(:group) { create(:group) } + before do + group.add_developer(user) + end it "shares project with group" do expires_at = 10.days.from_now.to_date @@ -1534,6 +1537,15 @@ describe API::Projects do expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq 'group_access does not have a valid value' end + + it "returns a 409 error when link is not saved" do + allow(::Projects::GroupLinks::CreateService).to receive_message_chain(:new, :execute) + .and_return({ status: :error, http_status: 409, message: 'error' }) + + post api("/projects/#{project.id}/share", user), params: { group_id: group.id, group_access: Gitlab::Access::DEVELOPER } + + expect(response).to have_gitlab_http_status(409) + end end describe 'DELETE /projects/:id/share/:group_id' do |