Welcome to mirror list, hosted at ThFree Co, Russian Federation.

activity_spec.rb « auth « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cbc42c464703195b49abfa6ca43b3d358f8466d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Gitlab::Auth::Activity 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

    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