2019-07-25 01:21:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-27 07:00:28 -04:00
|
|
|
require 'fast_spec_helper'
|
2018-07-17 08:50:04 -04:00
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe Gitlab::Auth::Activity do
|
2018-07-27 07:00:28 -04:00
|
|
|
describe '.each_counter' do
|
2018-07-17 08:50:04 -04:00
|
|
|
it 'has all static counters defined' do
|
2018-07-20 09:06:11 -04:00
|
|
|
described_class.each_counter do |counter|
|
|
|
|
expect(described_class).to respond_to(counter)
|
2018-07-17 08:50:04 -04:00
|
|
|
end
|
|
|
|
end
|
2018-07-27 06:56:34 -04:00
|
|
|
|
2018-07-27 07:00:28 -04:00
|
|
|
it 'has all static incrementers defined' do
|
|
|
|
described_class.each_counter do |counter|
|
|
|
|
expect(described_class).to respond_to("#{counter}_increment!")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has all counters starting with `user_`' do
|
|
|
|
described_class.each_counter do |counter|
|
|
|
|
expect(counter).to start_with('user_')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'yields counter method, name and description' do
|
|
|
|
described_class.each_counter do |method, name, description|
|
|
|
|
expect(method).to eq "#{name}_counter"
|
|
|
|
expect(description).to start_with('Counter of')
|
|
|
|
end
|
|
|
|
end
|
2018-07-17 08:50:04 -04:00
|
|
|
end
|
|
|
|
end
|