Sha256: d5a8929c075d6b3fc00d9154ff9b86977e7fc5c3ad8a2ee8505550fb987254c0

Contents?: true

Size: 942 Bytes

Versions: 15

Compression:

Stored size: 942 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class UserInformerTest < Test::Unit::TestCase
  should "modify output if there is an airbrake id" do
    main_app = lambda do |env|
      env['airbrake.error_id'] = 1
      [200, {}, ["<!-- AIRBRAKE ERROR -->"]]
    end
    informer_app = Airbrake::UserInformer.new(main_app)

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

    response = Net::HTTP.get_response(URI.parse("http://example.com/"))
    assert_equal "Airbrake Error 1", response.body
    assert_equal 16, response["Content-Length"].to_i
  end

  should "not modify output if there is no airbrake id" do
    main_app = lambda do |env|
      [200, {}, ["<!-- AIRBRAKE ERROR -->"]]
    end
    informer_app = Airbrake::UserInformer.new(main_app)

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

    response = Net::HTTP.get_response(URI.parse("http://example.com/"))
    assert_equal "<!-- AIRBRAKE ERROR -->", response.body
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
airbrake-3.1.2 test/user_informer_test.rb
airbrake-3.1.1 test/user_informer_test.rb
airbrake-3.1.0 test/user_informer_test.rb
airbrake-3.0.9 test/user_informer_test.rb
airbrake-3.0.8 test/user_informer_test.rb
airbrake-3.0.7 test/user_informer_test.rb
airbrake-3.0.6 test/user_informer_test.rb
airbrake-3.0.5 test/user_informer_test.rb
airbrake-3.0.4 test/user_informer_test.rb
airbrake-3.0.3 test/user_informer_test.rb
airbrake-3.0.2 test/user_informer_test.rb
airbrake-3.0.1 test/user_informer_test.rb
airbrake-3.0 test/user_informer_test.rb
airbrake-3.0.rc2 test/user_informer_test.rb
airbrake-3.0.rc1 test/user_informer_test.rb