Sha256: 189a56a4c32031cf6788277de764318dcd4423723e48350ad4023fb65a0133a8

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

require File.expand_path '../helper', __FILE__

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

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

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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
projectlocker_pulse-1.0.0 test/user_informer_test.rb
projectlocker_pulse-0.2.1 test/user_informer_test.rb