Sha256: 55519bedaf86292e738c56b2b073cd777de8192551aed39c521dd9557c5e5065

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

require 'helper'

class TestMiddleware < Minitest::Test
  def setup
    @middleware = Raisin::Middleware.new(->(env) { :ok })
  end

  def test_not_vendored_header
    assert_equal :ok, @middleware.call({})
  end

  def test_wrong_vendor_header
    env = {}

    assert_equal :ok, @middleware.call(env)
    assert_empty env
  end

  def test_vendored_header
    env = {
      'action_dispatch.request.parameters' => {},
      'HTTP_ACCEPT' => 'application/vnd.acme.v1+json'
    }

    assert_equal :ok, @middleware.call(env)
    assert_equal 'v1', env['raisin.version']
    refute_empty env['action_dispatch.request.formats']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
raisin-0.2.0 test/test_middleware.rb