Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule MyPlugTest do
- use ExUnit.Case, async: true
- use Plug.Test
- @opts AppRouter.init([])
- test "returns hello world" do
- # Create a test connection
- conn = conn(:get, "/hello")
- # Invoke the plug
- conn = AppRouter.call(conn, @opts)
- # Assert the response and status
- assert conn.state == :sent
- assert conn.status == 200
- assert conn.resp_body == "world"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement