Skip to content

Commit 7a6b961

Browse files
committed
Rename routes_info to format_routes
1 parent 0f2e4ab commit 7a6b961

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

lib/test_server.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ defmodule TestServer do
8989
raise """
9090
The test ended before the following #{inspect(__MODULE__)} route(s) received a request:
9191
92-
#{Instance.routes_info(routes)}
92+
#{Instance.format_routes(routes)}
9393
"""
9494
end
9595
end

lib/test_server/instance.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ defmodule TestServer.Instance do
4242
|> Enum.reject(& &1.suspended)
4343
end
4444

45-
@spec routes_info([map()]) :: binary()
46-
def routes_info(routes) do
45+
@spec format_routes([map()]) :: binary()
46+
def format_routes([]), do: "None"
47+
def format_routes(routes) do
4748
routes
4849
|> Enum.with_index()
4950
|> Enum.map_join("\n\n", fn {route, index} ->

lib/test_server/plug_cowboy.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ defmodule TestServer.Plug.Cowboy do
121121
122122
Active routes for request:
123123
124-
#{case Instance.active_routes(instance) do
125-
[] -> "None"
126-
routes -> Instance.routes_info(routes)
127-
end}
124+
#{Instance.format_routes(Instance.active_routes(instance))}
128125
"""
129126
)
130127

0 commit comments

Comments
 (0)