1
0
Fork 0
mirror of https://github.com/edgurgel/httparrot synced 2025-04-06 00:32:34 -04:00
httparrot/test/status_code_handler_test.exs
2013-12-27 18:47:21 -03:00

21 lines
503 B
Elixir

defmodule HTTParrot.StatusCodeHandlerTest do
use ExUnit.Case
import :meck
import HTTParrot.StatusCodeHandler
setup do
new :cowboy_req
end
teardown do
unload :cowboy_req
end
test "reply with 'code' as status code" do
code = 123
expect(:cowboy_req, :binding, [{[:code, :req1], {code, :req2}}])
expect(:cowboy_req, :reply, [{[code, [], "", :req2], {:ok, :req3}}])
assert get_json(:req1, :state) == {:halt, :req3, :state}
assert validate :cowboy_req
end
end