Sha256: 1e191080980d6a46282ee9f2eb31f7775cef63371d28aace134302a0cc21fdc8

Contents?: true

Size: 958 Bytes

Versions: 18

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'
require 'sham_rack'

describe Honeybadger::UserInformer do
  it 'modifies output if there is a honeybadger id' do
    main_app = lambda do |env|
      env['honeybadger.error_id'] = 1
      [200, {}, ["<!-- HONEYBADGER ERROR -->"]]
    end
    informer_app = Honeybadger::UserInformer.new(main_app)

    ShamRack.mount(informer_app, "example.com")

    response = Net::HTTP.get_response(URI.parse("http://example.com/"))
    expect(response.body).to eq 'Honeybadger Error 1'
    expect(response["Content-Length"].to_i).to eq 19
  end

  it 'does not modify output if there is no honeybadger id' do
    main_app = lambda do |env|
      [200, {}, ["<!-- HONEYBADGER ERROR -->"]]
    end
    informer_app = Honeybadger::UserInformer.new(main_app)

    ShamRack.mount(informer_app, "example.com")

    response = Net::HTTP.get_response(URI.parse("http://example.com/"))
    expect(response.body).to eq '<!-- HONEYBADGER ERROR -->'
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
honeybadger-1.13.2 spec/honeybadger/user_informer_spec.rb
honeybadger-1.13.1 spec/honeybadger/user_informer_spec.rb
honeybadger-1.13.0 spec/honeybadger/user_informer_spec.rb
honeybadger-1.12.0.beta3 spec/honeybadger/user_informer_spec.rb
honeybadger-1.12.0.beta2 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.2 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.1 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.0 spec/honeybadger/user_informer_spec.rb
honeybadger-1.10.3 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.0.beta4 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.0.beta3 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.0.beta2 spec/honeybadger/user_informer_spec.rb
honeybadger-1.10.2 spec/honeybadger/user_informer_spec.rb
honeybadger-1.11.0.beta1 spec/honeybadger/user_informer_spec.rb
honeybadger-1.10.1 spec/honeybadger/user_informer_spec.rb
honeybadger-1.10.0 spec/honeybadger/user_informer_spec.rb
honeybadger-1.10.0.beta2 spec/honeybadger/user_informer_spec.rb
honeybadger-1.10.0.beta1 spec/honeybadger/user_informer_spec.rb