diff options
Diffstat (limited to 'spec/requests/admin')
-rw-r--r-- | spec/requests/admin/users_controller_spec.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/requests/admin/users_controller_spec.rb b/spec/requests/admin/users_controller_spec.rb index 5344a2c2bb7..21cf8ab2c79 100644 --- a/spec/requests/admin/users_controller_spec.rb +++ b/spec/requests/admin/users_controller_spec.rb @@ -6,12 +6,12 @@ RSpec.describe Admin::UsersController, :enable_admin_mode, feature_category: :us let_it_be(:admin) { create(:admin) } let_it_be(:user) { create(:user) } + before do + sign_in(admin) + end + describe 'PUT #block' do context 'when request format is :json' do - before do - sign_in(admin) - end - subject(:request) { put block_admin_user_path(user, format: :json) } context 'when user was blocked' do @@ -39,4 +39,16 @@ RSpec.describe Admin::UsersController, :enable_admin_mode, feature_category: :us end end end + + describe 'PUT #unlock' do + before do + user.lock_access! + end + + subject(:request) { put unlock_admin_user_path(user) } + + it 'unlocks the user' do + expect { request }.to change { user.reload.access_locked? }.from(true).to(false) + end + end end |