Commit 82539cff authored by Robert Speicher's avatar Robert Speicher

Merge branch 'clean-up-user-controller-spec' into 'master'

Minor clean up on admin/users_controller_spec

Extracted from !3439 

See merge request !3460
parents 1bb7a6c4 340f1fc9
require 'spec_helper' require 'spec_helper'
describe Admin::UsersController do describe Admin::UsersController do
let(:admin) { create(:admin) } let(:user) { create(:user) }
before do before do
sign_in(admin) sign_in(create(:admin))
end end
describe 'DELETE #user with projects' do describe 'DELETE #user with projects' do
let(:user) { create(:user) } let(:project) { create(:empty_project, namespace: user.namespace) }
let(:project) { create(:project, namespace: user.namespace) }
before do before do
project.team << [user, :developer] project.team << [user, :developer]
...@@ -23,8 +22,6 @@ describe Admin::UsersController do ...@@ -23,8 +22,6 @@ describe Admin::UsersController do
end end
describe 'PUT block/:id' do describe 'PUT block/:id' do
let(:user) { create(:user) }
it 'blocks user' do it 'blocks user' do
put :block, id: user.username put :block, id: user.username
user.reload user.reload
...@@ -50,8 +47,6 @@ describe Admin::UsersController do ...@@ -50,8 +47,6 @@ describe Admin::UsersController do
end end
context 'manually blocked users' do context 'manually blocked users' do
let(:user) { create(:user) }
before do before do
user.block user.block
end end
...@@ -66,8 +61,6 @@ describe Admin::UsersController do ...@@ -66,8 +61,6 @@ describe Admin::UsersController do
end end
describe 'PUT unlock/:id' do describe 'PUT unlock/:id' do
let(:user) { create(:user) }
before do before do
request.env["HTTP_REFERER"] = "/" request.env["HTTP_REFERER"] = "/"
user.lock_access! user.lock_access!
...@@ -95,8 +88,6 @@ describe Admin::UsersController do ...@@ -95,8 +88,6 @@ describe Admin::UsersController do
end end
describe 'PATCH disable_two_factor' do describe 'PATCH disable_two_factor' do
let(:user) { create(:user) }
it 'disables 2FA for the user' do it 'disables 2FA for the user' do
expect(user).to receive(:disable_two_factor!) expect(user).to receive(:disable_two_factor!)
allow(subject).to receive(:user).and_return(user) allow(subject).to receive(:user).and_return(user)
......
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