defmodule Reactor.Req.PostTest do @moduledoc false use ExUnit.Case, async: true alias Plug.Conn defmodule PostReactor do @moduledoc false use Reactor, extensions: [Reactor.Req] input :url req_post :request do url input(:url) http_errors value(:raise) end end test "it can send a POST request", %{test: test} do port = Enum.random(1000..0xFFFF) start_link_supervised!( {Support.HttpServer, id: test, port: port, stub: fn conn -> Conn.send_resp(conn, 200, conn.method) end} ) assert {:ok, response} = Reactor.run(PostReactor, %{url: "http://localhost:#{port}/stub"}) assert response.status == 200 assert response.body == "POST" end end