Skip to content

Commit 5a99cd2

Browse files
committed
add test case for aliased modules
1 parent 6de63c2 commit 5a99cd2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/mix/tasks/phoenix_sync.install_test.exs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,39 @@ defmodule Mix.Tasks.PhoenixSync.InstallTest do
496496
)
497497
end
498498

499+
@tag files: %{
500+
"lib/test_plug/application.ex" => """
501+
defmodule TestPlug.Application do
502+
use Application
503+
504+
alias TestPlug.Router
505+
506+
def start(_type, _args) do
507+
children = [
508+
{Plug.Cowboy, scheme: :http, plug: {Router, my_config: [here: true]}, options: [port: 4040]}
509+
]
510+
511+
opts = [strategy: :one_for_one, name: TestPlug.Supervisor]
512+
Supervisor.start_link(children, opts)
513+
end
514+
end
515+
"""
516+
}
517+
test "supports aliased plug modules", ctx do
518+
ctx.igniter
519+
|> assert_has_patch(
520+
"lib/test_plug/application.ex",
521+
"""
522+
- | {Plug.Cowboy, scheme: :http, plug: {Router, my_config: [here: true]}, options: [port: 4040]}
523+
+ | {Plug.Cowboy,
524+
+ | scheme: :http,
525+
+ | plug: {Router, [my_config: [here: true], phoenix_sync: Phoenix.Sync.plug_opts()]},
526+
+ | options: [port: 4040]}
527+
528+
"""
529+
)
530+
end
531+
499532
@tag files: %{
500533
"lib/test_plug/application.ex" =>
501534
plug_application.("{Bandit, scheme: :http, plug: TestPlug.Router, port: 4040}")

0 commit comments

Comments
 (0)