1
0
Fork 0
mirror of https://github.com/edgurgel/httparrot synced 2025-04-06 00:32:34 -04:00
httparrot/test/get_handler_test.exs
Eduardo Gurgel a049031f67 Rewrite tests to be less integrated
Now mocking JSEX
2013-12-30 23:37:18 -03:00

25 lines
591 B
Elixir

defmodule HTTParrot.GetHandlerTest do
use ExUnit.Case
import :meck
import HTTParrot.GetHandler
setup do
new HTTParrot.GeneralRequestInfo
new JSEX
end
teardown do
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}])
assert get_json(:req1, :state) == {:json, :req2, :state}
assert validate HTTParrot.GeneralRequestInfo
assert validate JSEX
end
end