From ef02ebfe3d7c4ceab37a586251fa58a182f603c3 Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Thu, 16 May 2024 16:42:36 +0200 Subject: [PATCH] Improve test --- test/req/test_test.exs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/req/test_test.exs b/test/req/test_test.exs index 886c11aa..fa11faf4 100644 --- a/test/req/test_test.exs +++ b/test/req/test_test.exs @@ -71,12 +71,15 @@ defmodule Req.TestTest do test "module" do defmodule Foo do - def init(options), do: options - def call(conn, []), do: Plug.Conn.send_resp(conn, 200, "hi") + def init([]), do: "default" + def init(other), do: other + def call(conn, string), do: Plug.Conn.send_resp(conn, 200, string) end Req.Test.stub(:foo, Foo) + assert Req.get!(plug: {Req.Test, :foo}).body == "default" + Req.Test.stub(:foo, {Foo, "hi"}) assert Req.get!(plug: {Req.Test, :foo}).body == "hi" end end