Sha256: 6430ff550173ce79448eed94f5ee3683a5c00b152639953803b8e8fbe55cdc53

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

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

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

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

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

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
projectlocker_errata-0.1.1 test/user_informer_test.rb
projectlocker_errata-0.1.0 test/user_informer_test.rb
projectlocker_errata-0.0.2 test/user_informer_test.rb
projectlocker_errata-0.0.1 test/user_informer_test.rb