Page MenuHomePhorge

No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/test/tesla/middleware/method_override_test.exs b/test/tesla/middleware/method_override_test.exs
index b75a40c..495aa81 100644
--- a/test/tesla/middleware/method_override_test.exs
+++ b/test/tesla/middleware/method_override_test.exs
@@ -1,72 +1,72 @@
defmodule Tesla.Middleware.MethodOverrideTest do
use ExUnit.Case
defmodule Client do
use Tesla
plug Tesla.Middleware.MethodOverride
adapter fn env ->
status =
case env do
%{method: :get} -> 200
%{method: :post} -> 201
%{method: _} -> 400
end
- %{env | status: status}
+ {:ok, %{env | status: status}}
end
end
test "when method is get" do
- response = Client.get("/")
+ assert {:ok, response} = Client.get("/")
assert response.status == 200
refute Tesla.get_header(response, "x-http-method-override")
end
test "when method is post" do
- response = Client.post("/", "")
+ assert {:ok, response} = Client.post("/", "")
assert response.status == 201
refute Tesla.get_header(response, "x-http-method-override")
end
test "when method isn't get or post" do
- response = Client.put("/", "")
+ assert {:ok, response} = Client.put("/", "")
assert response.status == 201
assert Tesla.get_header(response, "x-http-method-override") == "put"
end
defmodule CustomClient do
use Tesla
plug Tesla.Middleware.MethodOverride, override: ~w(put)a
adapter fn env ->
status =
case env do
%{method: :get} -> 200
%{method: :post} -> 201
%{method: _} -> 400
end
- %{env | status: status}
+ {:ok, %{env | status: status}}
end
end
test "when method in override list" do
- response = CustomClient.put("/", "")
+ assert {:ok, response} = CustomClient.put("/", "")
assert response.status == 201
assert Tesla.get_header(response, "x-http-method-override") == "put"
end
test "when method not in override list" do
- response = CustomClient.patch("/", "")
+ assert {:ok, response} = CustomClient.patch("/", "")
assert response.status == 400
refute Tesla.get_header(response, "x-http-method-override")
end
end

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 10:02 PM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40087
Default Alt Text
(2 KB)

Event Timeline