Commit 656985bf authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make authentication metrics events explicit is specs

parent 0da5c588
......@@ -28,6 +28,6 @@ Rails.application.configure do |config|
user = user_warden || auth.user
ActiveSession.destroy(user, auth.request.session.id)
Gitlab::Auth::Activity.new(user, opts).user_signed_out!
Gitlab::Auth::Activity.new(user, opts).user_session_destroyed!
end
end
......@@ -12,9 +12,9 @@ module Gitlab
user_not_found: 'Counter of total failed log-ins when user is unknown',
user_password_invalid: 'Counter of failed log-ins with invalid password',
user_session_override: 'Counter of manual log-ins and sessions overrides',
user_session_destroyed: 'Counter of total user sessions being destroyed',
user_two_factor_authenticated: 'Counter of two factor authentications',
user_blocked: 'Counter of total sign in attempts when user is blocked',
user_signed_out: 'Counter of total user sign out events'
user_blocked: 'Counter of total sign in attempts when user is blocked'
}.freeze
def initialize(user, opts)
......@@ -50,8 +50,8 @@ module Gitlab
end
end
def user_signed_out!
self.class.user_signed_out_counter_increment!
def user_session_destroyed!
self.class.user_session_destroyed_counter_increment!
end
def self.each_counter
......
This diff is collapsed.
......@@ -7,7 +7,6 @@ module StubMetrics
authentication_metrics.each_counter do |name, metric, description|
double("#{metric} - #{description}").tap do |counter|
allow(authentication_metrics).to receive(name).and_return(counter)
allow(counter).to receive(:increment) # TODO, require expectations
end
end
......
RSpec::Matchers.define :increment do |counter|
match do |adapter|
expect(adapter.send(counter)).to receive(:increment)
expect(adapter.send(counter))
.to receive(:increment)
.exactly(@exactly || :once)
end
chain :twice do
@exactly = :twice
end
end
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