rodeo v0.2.0 Rodeo.HTTPCase

Summary

Functions

Starts a cowboy server at a random open TCP port with handler handler (see Rodeo.Handler), runs block and terminates the server instance

Functions

with_webserver(handler \\ Rodeo.Handler.Default, list) (macro)

Starts a cowboy server at a random open TCP port with handler handler (see Rodeo.Handler), runs block and terminates the server instance.

The variable port is available within the block, holding the TCP port number of the running cowboy web server.

ExUnit Example

test "my private webserver with explicit require" do
  require Rodeo.HTTPCase
  Rodeo.HTTPCase.with_webserver(:my_handler) do
    assert is_integer(port)
  end
end

test "my private webserver calling __using__ first" do
  use Rodeo.HTTPCase
  with_webserver(:my_handler), do: assert(is_integer(port))
end