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

notifier_spec.rb « circuit_breaker « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1640ebb99f96769259730319f0c344bd1d63d638 (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
33
34
35
36
37
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::CircuitBreaker::Notifier, feature_category: :shared do
  subject(:instance) { described_class.new }

  describe '#notify' do
    context 'when event is failure' do
      it 'sends an exception to Gitlab::ErrorTracking' do
        expect(Gitlab::ErrorTracking).to receive(:track_exception)

        instance.notify('test_service', 'failure')
      end
    end

    context 'when event is not failure' do
      it 'does not send an exception to Gitlab::ErrorTracking' do
        expect(Gitlab::ErrorTracking).not_to receive(:track_exception)

        instance.notify('test_service', 'test_event')
      end
    end
  end

  describe '#notify_warning' do
    it do
      expect { instance.notify_warning('test_service', 'test_message') }.not_to raise_error
    end
  end

  describe '#notify_run' do
    it do
      expect { instance.notify_run('test_service') { puts 'test block' } }.not_to raise_error
    end
  end
end