1
0
Fork 0
mirror of https://github.com/edgurgel/httparrot synced 2025-04-06 00:32:34 -04:00
httparrot/test/delete_handler_test.exs
2014-01-04 23:31:55 -03:00

29 lines
745 B
Elixir

defmodule HTTParrot.DeleteHandlerTest do
use ExUnit.Case
import :meck
import HTTParrot.DeleteHandler
setup do
new :cowboy_req
new HTTParrot.GeneralRequestInfo
new JSEX
end
teardown do
unload :cowboy_req
unload HTTParrot.GeneralRequestInfo
unload JSEX
end
test "returns prettified json with query values, headers, url and origin" do
expect(HTTParrot.GeneralRequestInfo, :retrieve, 1, {:info, :req2})
expect(JSEX, :encode!, [{[:info], :json}])
expect(:cowboy_req, :set_resp_body, [{[:json, :req2], :req3}])
assert delete_resource(:req1, :state) == {true, :req3, :state}
assert validate :cowboy_req
assert validate HTTParrot.GeneralRequestInfo
assert validate JSEX
end
end