Sha256: d173d5f12052a2a45e9e6cd872b4ebc3fe93a77a2d82c3fde6a2a9ab71226810

Contents?: true

Size: 785 Bytes

Versions: 3

Compression:

Stored size: 785 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

# To allow sidekiq error handlers to be registered, sidekiq must be in
# "server mode". This mode is triggered by loading sidekiq/cli. Note this
# has to be loaded before exception_notification/sidekiq.
require 'sidekiq/cli'
require 'sidekiq/testing'

require 'exception_notification/sidekiq'

class MockSidekiqServer
  include ::Sidekiq::ExceptionHandler
end

class SidekiqTest < ActiveSupport::TestCase
  test 'should call notify_exception when sidekiq raises an error' do
    server = MockSidekiqServer.new
    message = {}
    exception = RuntimeError.new

    ExceptionNotifier.expects(:notify_exception).with(
      exception,
      data: { sidekiq: message }
    )

    server.handle_exception(exception, message)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exception_notification-4.5.0 test/exception_notifier/sidekiq_test.rb
exception_notification-4.4.3 test/exception_notifier/sidekiq_test.rb
exception_notification-4.4.1 test/exception_notifier/sidekiq_test.rb