diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 15:07:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 15:07:52 +0300 |
commit | c6c7437861bff9572747674095c4dfbdfbea4988 (patch) | |
tree | 237d1ed922193f19ae326923457344c082003788 /spec/requests/api/users_spec.rb | |
parent | d80f3cd75e700b6e62910865bfd36734644ffa89 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r-- | spec/requests/api/users_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 8b9d0391b79..4a89069cbec 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -2165,14 +2165,20 @@ describe API::Users, :do_not_mock_admin_mode do end describe 'POST /users/:id/block' do + let(:blocked_user) { create(:user, state: 'blocked') } + before do admin end it 'blocks existing user' do post api("/users/#{user.id}/block", admin) - expect(response).to have_gitlab_http_status(:created) - expect(user.reload.state).to eq('blocked') + + aggregate_failures do + expect(response).to have_gitlab_http_status(:created) + expect(response.body).to eq('true') + expect(user.reload.state).to eq('blocked') + end end it 'does not re-block ldap blocked users' do @@ -2192,6 +2198,15 @@ describe API::Users, :do_not_mock_admin_mode do expect(response).to have_gitlab_http_status(:not_found) expect(json_response['message']).to eq('404 User Not Found') end + + it 'returns a 201 if user is already blocked' do + post api("/users/#{blocked_user.id}/block", admin) + + aggregate_failures do + expect(response).to have_gitlab_http_status(:created) + expect(response.body).to eq('null') + end + end end describe 'POST /users/:id/unblock' do |