Commit a8c5790d authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'move-deactivate-user-creation-higher' into 'master'

Avoid repeat creation of deactivated user

See merge request gitlab-org/gitlab!69419
parents 6fca1859 b7559e32
......@@ -2602,15 +2602,13 @@ RSpec.describe API::Users do
let(:api_user) { admin }
context 'for a deactivated user' do
before do
user.deactivate
end
let(:user_id) { deactivated_user.id }
it 'activates a deactivated user' do
activate
expect(response).to have_gitlab_http_status(:created)
expect(user.reload.state).to eq('active')
expect(deactivated_user.reload.state).to eq('active')
end
end
......@@ -2714,15 +2712,13 @@ RSpec.describe API::Users do
end
context 'for a deactivated user' do
before do
user.deactivate
end
let(:user_id) { deactivated_user.id }
it 'returns 201' do
deactivate
expect(response).to have_gitlab_http_status(:created)
expect(user.reload.state).to eq('deactivated')
expect(deactivated_user.reload.state).to eq('deactivated')
end
end
......@@ -2791,7 +2787,6 @@ RSpec.describe API::Users do
describe 'POST /users/:id/approve' do
subject(:approve) { post api("/users/#{user_id}/approve", api_user) }
let_it_be(:deactivated_user) { create(:user, :deactivated) }
let_it_be(:blocked_user) { create(:user, :blocked) }
context 'performed by a non-admin user' do
......
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