diff options
| author | Andrew Tomaka <atomaka@gmail.com> | 2015-12-01 23:40:24 -0500 |
|---|---|---|
| committer | Andrew Tomaka <atomaka@gmail.com> | 2015-12-02 08:07:29 -0500 |
| commit | daca985a6e75d6f43c5cc5b487a0942d5bf93f68 (patch) | |
| tree | 579e8734014953e8aaa1c784cd4a857e50c6ed79 /spec/controllers/admin | |
| parent | 09e712c0fb721059e4b2619eb9fc104257fc492d (diff) | |
| download | gitlab-ce-daca985a6e75d6f43c5cc5b487a0942d5bf93f68.tar.gz | |
Prevent impersonation if blocked
Diffstat (limited to 'spec/controllers/admin')
| -rw-r--r-- | spec/controllers/admin/impersonation_controller_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/controllers/admin/impersonation_controller_spec.rb b/spec/controllers/admin/impersonation_controller_spec.rb new file mode 100644 index 00000000000..d7a7ba1c5b6 --- /dev/null +++ b/spec/controllers/admin/impersonation_controller_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe Admin::ImpersonationController do + let(:admin) { create(:admin) } + + before do + sign_in(admin) + end + + describe 'CREATE #impersonation when blocked' do + let(:blocked_user) { create(:user, state: :blocked) } + + it 'does not allow impersonation' do + post :create, id: blocked_user.username + + expect(flash[:alert]).to eq 'You cannot impersonate a blocked user' + end + end +end |
