Commit bda912dc authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'if-10139-ee_specific_lines_members_api_spec' into 'master'

Move EE specific lines in API::Members spec

See merge request gitlab-org/gitlab-ee!12979
parents 7a9963c6 134c389f
require 'spec_helper'
describe API::Members do
let(:user) { create(:user) }
describe 'POST /projects/:id/members' do
context 'group membership locked' do
let(:owner) { create(:user) }
let(:group) { create(:group, membership_lock: true)}
let(:project) { create(:project, group: group) }
before do
group.add_owner(owner)
end
context 'project in a group' do
it 'returns a 405 method not allowed error when group membership lock is enabled' do
post api("/projects/#{project.id}/members", owner),
params: { user_id: user.id, access_level: Member::MAINTAINER }
expect(response.status).to eq 405
end
end
end
end
end
...@@ -293,23 +293,6 @@ describe API::Members do ...@@ -293,23 +293,6 @@ describe API::Members do
end end
end end
## EE specific
shared_examples 'POST /projects/:id/members with the project group membership locked' do
context 'project in a group' do
it 'returns a 405 method not allowed error when group membership lock is enabled' do
group_with_membership_locked = create(:group, membership_lock: true)
project = create(:project, group: group_with_membership_locked)
project.group.add_owner(maintainer)
post api("/projects/#{project.id}/members", maintainer),
params: { user_id: developer.id, access_level: Member::MAINTAINER }
expect(response.status).to eq 405
end
end
end
## EE specific
shared_examples 'PUT /:source_type/:id/members/:user_id' do |source_type| shared_examples 'PUT /:source_type/:id/members/:user_id' do |source_type|
context "with :source_type == #{source_type.pluralize}" do context "with :source_type == #{source_type.pluralize}" do
it_behaves_like 'a 404 response when source is private' do it_behaves_like 'a 404 response when source is private' do
...@@ -450,10 +433,6 @@ describe API::Members do ...@@ -450,10 +433,6 @@ describe API::Members do
let(:source) { project } let(:source) { project }
end end
## EE specific
it_behaves_like 'POST /projects/:id/members with the project group membership locked'
## EE specific
it_behaves_like 'POST /:source_type/:id/members', 'group' do it_behaves_like 'POST /:source_type/:id/members', 'group' do
let(:source) { group } let(:source) { group }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment