Sha256: 3dc420a3e432efbcd0a646021a1c8dc6cd9c6fb59b90b713a56332aa525757b5

Contents?: true

Size: 968 Bytes

Versions: 15

Compression:

Stored size: 968 Bytes

Contents

require 'spec_helper'

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
  RSpec.describe "airbrake/sidekiq/error_handler" do
    let(:endpoint) do
      'https://airbrake.io/api/v3/projects/113743/notices?key=fd04e13d806a90f96614ad8e529b2822'
    end

    def wait_for_a_request_with_body(body)
      wait_for(a_request(:post, endpoint).with(body: body)).to have_been_made.once
    end

    before do
      stub_request(:post, endpoint).to_return(status: 201, body: '{}')
    end

    it "sends a notice to Airbrake" do
      handler = Sidekiq.error_handlers.last
      handler.call(
        AirbrakeTestError.new('sidekiq error'),
        'class' => 'HardSidekiqWorker', 'args' => %w(bango bongo)
      )

      wait_for_a_request_with_body(/"message":"sidekiq\serror"/)
      wait_for_a_request_with_body(/"params":{.*"args":\["bango","bongo"\]/)
      wait_for_a_request_with_body(/"component":"sidekiq","action":"HardSidekiqWorker"/)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
airbrake-5.4.1 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.4.0 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.3.0 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.2.3 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.2.2 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.2.1 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.2.0 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.1.0 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.5 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.4 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.3 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.2 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.1 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.0 spec/unit/sidekiq/error_handler_spec.rb
airbrake-5.0.0.rc.1 spec/unit/sidekiq/error_handler_spec.rb