diff options
Diffstat (limited to 'spec/lib/gitlab/circuit_breaker/notifier_spec.rb')
-rw-r--r-- | spec/lib/gitlab/circuit_breaker/notifier_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/gitlab/circuit_breaker/notifier_spec.rb b/spec/lib/gitlab/circuit_breaker/notifier_spec.rb new file mode 100644 index 00000000000..1640ebb99f9 --- /dev/null +++ b/spec/lib/gitlab/circuit_breaker/notifier_spec.rb @@ -0,0 +1,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 |