Commit bfe7d57d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'issue_6536' into 'master'

Extract EE specific files/lines for spec/controllers/groups

Closes #6536

See merge request gitlab-org/gitlab-ee!10524
parents f16112e3 649d23b9
......@@ -31,6 +31,14 @@ describe Groups::GroupMembersController do
expect(response).to have_gitlab_http_status(302)
end
it 'creates an audit event' do
expect do
post :create, params: { group_id: group,
user_ids: user.id,
access_level: Gitlab::Access::GUEST }
end.to change(AuditEvent, :count).by(1)
end
end
describe 'PUT #update' do
......@@ -82,6 +90,32 @@ describe Groups::GroupMembersController do
expect(response).to have_gitlab_http_status(302)
end
context 'when member is not an owner' do
it 'creates an audit event' do
developer = create(:user)
group.add_developer(developer)
sign_in(developer)
expect { delete :leave, params: { group_id: group } }.to change(AuditEvent, :count).by(1)
end
end
context 'when member is an owner' do
it 'does not create an audit event' do
expect { delete :leave, params: { group_id: group } }.not_to change(AuditEvent, :count)
end
end
context 'when member requested access' do
it 'creates an audit event' do
requester = create(:user)
group.request_access(requester)
sign_in(requester)
expect { delete :leave, params: { group_id: group } }.to change(AuditEvent, :count).by(1)
end
end
end
describe 'POST #resend_invite' do
......
......@@ -55,7 +55,7 @@ describe Groups::BoardsController do
context 'when format is JSON' do
it 'return an array with one group board' do
create(:board, group: group, milestone: create(:milestone, group: group))
create(:board, group: group)
expect(Boards::Visits::LatestService).not_to receive(:new)
......
......@@ -54,14 +54,6 @@ describe Groups::GroupMembersController do
expect(group.users).to include group_user
end
it 'creates an audit event' do
expect do
post :create, params: { group_id: group,
user_ids: group_user.id,
access_level: Gitlab::Access::GUEST }
end.to change(AuditEvent, :count).by(1)
end
it 'adds no user to members' do
post :create, params: {
group_id: group,
......@@ -182,10 +174,6 @@ describe Groups::GroupMembersController do
expect(response).to have_gitlab_http_status(200)
expect(json_response['notice']).to eq "You left the \"#{group.name}\" group."
end
it 'creates an audit event' do
expect { delete :leave, params: { group_id: group } }.to change(AuditEvent, :count).by(1)
end
end
context 'and is an owner' do
......@@ -198,10 +186,6 @@ describe Groups::GroupMembersController do
expect(response).to have_gitlab_http_status(403)
end
it 'does not create an audit event' do
expect { delete :leave, params: { group_id: group } }.not_to change(AuditEvent, :count)
end
end
context 'and is a requester' do
......@@ -217,10 +201,6 @@ describe Groups::GroupMembersController do
expect(group.requesters).to be_empty
expect(group.users).not_to include user
end
it 'creates an audit event' do
expect { delete :leave, params: { group_id: group } }.to change(AuditEvent, :count).by(1)
end
end
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