From 2ead2b97482e8e4cafbb5cdf38781df428ee0584 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 27 Jul 2018 13:00:28 +0200 Subject: [PATCH] Improce specs of authentication activity class methods --- spec/lib/gitlab/auth/activity_spec.rb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/spec/lib/gitlab/auth/activity_spec.rb b/spec/lib/gitlab/auth/activity_spec.rb index 89ba8894821..07854cb1eba 100644 --- a/spec/lib/gitlab/auth/activity_spec.rb +++ b/spec/lib/gitlab/auth/activity_spec.rb @@ -1,14 +1,30 @@ -require 'spec_helper' +require 'fast_spec_helper' describe Gitlab::Auth::Activity do - describe '#each_counter' do + 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 - # todo incrementer pairs - # todo all metrics starting with `user`_ + 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