debian-mirror-gitlab/spec/lib/gitlab/usage_data_counters_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
794 B
Ruby
Raw Permalink Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
2022-10-11 01:57:18 +05:30
require 'fast_spec_helper'
2021-02-22 17:27:13 +05:30
RSpec.describe Gitlab::UsageDataCounters do
describe '.usage_data_counters' do
subject { described_class.counters }
it { is_expected.to all(respond_to :totals) }
it { is_expected.to all(respond_to :fallback_totals) }
end
describe '.count' do
subject { described_class.count(event_name) }
2022-07-23 23:45:48 +05:30
let(:event_name) { 'web_ide_views' }
2021-02-22 17:27:13 +05:30
it 'increases a view counter' do
2022-07-23 23:45:48 +05:30
expect(Gitlab::UsageDataCounters::WebIdeCounter).to receive(:count).with('views')
2021-02-22 17:27:13 +05:30
subject
end
context 'when event_name is not defined' do
let(:event_name) { 'unknown' }
it 'raises an exception' do
expect { subject }.to raise_error(Gitlab::UsageDataCounters::UnknownEvent)
end
end
end
end