Sha256: 4705c4d996e344bd85a96da106d95b4b7911917f94c20455cbc9397a2e6e3afa

Contents?: true

Size: 948 Bytes

Versions: 8

Compression:

Stored size: 948 Bytes

Contents

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

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

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

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

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

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

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
square-hoptoad_notifier-2.4.9 test/user_informer_test.rb
hoptoad_notifier-2.4.11 test/user_informer_test.rb
hoptoad_notifier-2.4.10 test/user_informer_test.rb
hoptoad_notifier-2.4.9 test/user_informer_test.rb
square-hoptoad_notifier-2.4.8 test/user_informer_test.rb
hoptoad_notifier-2.4.8 test/user_informer_test.rb
hoptoad_notifier-2.4.7 test/user_informer_test.rb
hoptoad_notifier-2.4.6 test/user_informer_test.rb