2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
require 'fast_spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::Auth::Activity do
|
2018-11-18 11:00:15 +05:30
|
|
|
describe '.each_counter' do
|
|
|
|
it 'has all static counters defined' do
|
|
|
|
described_class.each_counter do |counter|
|
|
|
|
expect(described_class).to respond_to(counter)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
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
|
|
|
|
end
|
|
|
|
end
|