Sha256: 6e01e6da470628c2d817727617be0cedec24cdcd0e0d8c82b36a373d41eefeea

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require 'test_helper'

class RepiaTest < ActiveSupport::TestCase
  test "HttpMethodNotAllowed middleware throws 405 for invalid HTTP method" do
    app = lambda {|env| [200, {}, [""]]}
    stack = Repia::HttpMethodNotAllowed.new(app)
    request = Rack::MockRequest.new(stack)
    response = request.request("DOESNOTEXIST", "/users")
    assert response.headers["Content-Type"].include?("application/json")
    assert_equal 405, response.status.to_i
  end

  test "HttpMethodNotAllowed middleware does not throw 405 for valid HTTP method" do
    app = lambda {|env| [200, {}, [""]]}
    stack = Repia::HttpMethodNotAllowed.new(app)
    request = Rack::MockRequest.new(stack)
    response = request.request("GET", "/users")
    assert_equal 200, response.status.to_i
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
repia-0.2.0 test/repia_middlewares_test.rb