blob: c0b56b5665eb77c75df18a15f33bda98cd7a8f61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
require 'spec_helper'
describe Gitlab::Auth::BlockedUserTracker do
describe '#log_blocked_user_activity!' do
context 'when user is not blocked' do
it 'does not blocked user activity' do
expect_any_instance_of(SystemHooksService)
.not_to receive(:execute_hooks_for)
expect(Gitlab::AppLogger).not_to receive(:info)
user = create(:user)
described_class.new(user, spy('auth')).log_activity!
end
end
context 'when user is not blocked' do
it 'logs blocked user activity' do
user = create(:user, :blocked)
expect_any_instance_of(SystemHooksService)
.to receive(:execute_hooks_for)
.with(user, :failed_login)
expect(Gitlab::AppLogger).to receive(:info)
.with(/Failed login for blocked user/)
described_class.new(user, spy('auth')).log_activity!
end
end
end
end
|