debian-mirror-gitlab/spec/services/wiki_pages/base_service_spec.rb

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

30 lines
761 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe WikiPages::BaseService do
2019-10-12 21:52:04 +05:30
let(:project) { double('project') }
let(:user) { double('user') }
describe '#increment_usage' do
counter = Gitlab::UsageDataCounters::WikiPageCounter
error = counter::UnknownEvent
2020-05-24 23:13:21 +05:30
let(:subject) { bad_service_class.new(container: project, current_user: user) }
2019-10-12 21:52:04 +05:30
2020-04-22 19:07:51 +05:30
context 'the class implements usage_counter_action incorrectly' do
let(:bad_service_class) do
Class.new(described_class) do
def usage_counter_action
:bad_event
end
2019-10-12 21:52:04 +05:30
end
end
2020-04-22 19:07:51 +05:30
it 'raises an error on unknown events' do
expect { subject.send(:increment_usage) }.to raise_error(error)
end
2019-10-12 21:52:04 +05:30
end
end
end