Sha256: 6fc045bd117e25ed55c13dc857a3efec2d5617644b576c1c27b9bbf3e62acc51

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

require 'minitest_config'

class TestMarlowe < Minitest::Test
  def setup
    @app = RackApp.new
    @middleware = Marlowe::Middleware.new(@app)
  end

  def test_no_header
    @middleware.call({})
    refute_empty @app.coordination_id
  end

  def test_with_header
    @middleware.call({'HTTP_CORRELATION_ID' => 'testvalue'})
    refute_empty @app.coordination_id
    assert_equal 'testvalue', @app.coordination_id
  end

  def test_with_custom_no_header
    @customized_middleware = Marlowe::Middleware.new(@app, correlation_header: "Custom-Header")
    @customized_middleware.call({})
    refute_empty @app.coordination_id
  end

  def test_with_custom_header
    @customized_middleware = Marlowe::Middleware.new(@app, correlation_header: "Custom-Header")
    @customized_middleware.call({'HTTP_CUSTOM_HEADER' => 'testvalue'})
    refute_empty @app.coordination_id
    assert_equal 'testvalue', @app.coordination_id
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marlowe-1.0.3 test/test_marlowe.rb