gitlab-org--gitlab-foss/spec/lib/gitlab/auth/blocked_user_tracker_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
948 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Auth::BlockedUserTracker do
2018-07-20 10:00:28 -04:00
describe '#log_blocked_user_activity!' do
context 'when user is not blocked' do
it 'does not log 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