Skip to content

Commit 447dadf

Browse files
authored
Merge pull request #235 from pow-auth/phoenix-components-template
Use Phoenix components templating
2 parents 1ba93f3 + cd612c8 commit 447dadf

File tree

23 files changed

+168
-77
lines changed

23 files changed

+168
-77
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
elixir: 1.14.0
3131
os: ubuntu-latest
3232
- otp: 22.0
33-
elixir: 1.11.0
34-
# It's necessary to run on ubunto 20.04 for OTP 20 - 25
33+
elixir: 1.12.0
34+
# It's necessary to run on ubuntu 20.04 for OTP 20 - 25
3535
# See https://github.com/erlef/setup-beam
3636
os: ubuntu-20.04
3737
runs-on: ${{ matrix.os }}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## v0.4.16 (TBA)
44

5+
Now uses Phoenix 1.7 components templating and requires Pow 1.0.29.
6+
57
### Enhancements
68

79
* [`Mix.Tasks.Pow.Ecto.Install`] Now injects `CONTEXT_PATH/users/user.ex`

config/test.exs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,44 @@ config :pow_assent, PowAssent.Test.Ecto.Repo,
88

99
config :pow_assent, PowAssent.Test.Phoenix.Endpoint,
1010
secret_key_base: String.duplicate("abcdefghijklmnopqrstuvxyz0123456789", 2),
11-
render_errors: [view: PowAssent.Test.Phoenix.ErrorView, accepts: ~w(html json)]
11+
render_errors: [
12+
formats: [html: PowAssent.Test.Phoenix.ErrorHTML],
13+
layout: false
14+
]
1215

1316
config :pow_assent, PowAssent.Test.EmailConfirmation.Phoenix.Endpoint,
1417
secret_key_base: String.duplicate("abcdefghijklmnopqrstuvxyz0123456789", 2),
15-
render_errors: [view: PowAssent.Test.Phoenix.ErrorView, accepts: ~w(html json)]
18+
render_errors: [
19+
formats: [html: PowAssent.Test.Phoenix.ErrorHTML],
20+
layout: false
21+
]
1622

1723
config :pow_assent, PowAssent.Test.Invitation.Phoenix.Endpoint,
1824
secret_key_base: String.duplicate("abcdefghijklmnopqrstuvxyz0123456789", 2),
19-
render_errors: [view: PowAssent.Test.Phoenix.ErrorView, accepts: ~w(html json)]
25+
render_errors: [
26+
formats: [html: PowAssent.Test.Phoenix.ErrorHTML],
27+
layout: false
28+
]
2029

2130
config :pow_assent, PowAssent.Test.NoRegistration.Phoenix.Endpoint,
2231
secret_key_base: String.duplicate("abcdefghijklmnopqrstuvxyz0123456789", 2),
23-
render_errors: [view: PowAssent.Test.Phoenix.ErrorView, accepts: ~w(html json)]
32+
render_errors: [
33+
formats: [html: PowAssent.Test.Phoenix.ErrorHTML],
34+
layout: false
35+
]
2436

2537
config :pow_assent, PowAssent.Test.WithCustomChangeset.Phoenix.Endpoint,
2638
secret_key_base: String.duplicate("abcdefghijklmnopqrstuvxyz0123456789", 2),
27-
render_errors: [view: PowAssent.Test.Phoenix.ErrorView, accepts: ~w(html json)]
39+
render_errors: [
40+
formats: [html: PowAssent.Test.Phoenix.ErrorHTML],
41+
layout: false
42+
]
2843

2944
config :pow_assent, PowAssent.Test.Reauthorization.Phoenix.Endpoint,
3045
secret_key_base: String.duplicate("abcdefghijklmnopqrstuvxyz0123456789", 2),
31-
render_errors: [view: PowAssent.Test.Phoenix.ErrorView, accepts: ~w(html json)]
46+
render_errors: [
47+
formats: [html: PowAssent.Test.Phoenix.ErrorHTML],
48+
layout: false
49+
]
3250

3351
config :phoenix, :json_library, Jason

lib/mix/tasks/phoenix/pow_assent.phoenix.gen.templates.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
defmodule Mix.Tasks.PowAssent.Phoenix.Gen.Templates do
2-
@shortdoc "Generates PowAssent views and templates"
2+
@shortdoc "Generates PowAssent templates"
33

44
@moduledoc """
55
Generates PowAssent templates for Phoenix.
@@ -38,7 +38,7 @@ defmodule Mix.Tasks.PowAssent.Phoenix.Gen.Templates do
3838
web_prefix = structure[:web_prefix]
3939

4040
Enum.each(@templates, fn {name, actions} ->
41-
Phoenix.create_view_file(Elixir.PowAssent, name, web_module, web_prefix)
41+
Phoenix.create_template_module(Elixir.PowAssent, name, web_module, web_prefix)
4242
Phoenix.create_templates(Elixir.PowAssent, name, web_prefix, actions)
4343
end)
4444

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
defmodule PowAssent.Phoenix.RegistrationHTML do
2+
@moduledoc false
3+
use Pow.Phoenix.Template
4+
5+
if Pow.dependency_vsn_match?(:phoenix, ">= 1.7.0") do
6+
template :add_user_id, :html,
7+
"""
8+
<div class="mx-auto max-w-sm">
9+
<.header class="text-center">
10+
Register
11+
</.header>
12+
13+
<.simple_form :let={f} for={<%= "@changeset" %>} as={:user} action={<%= "@action" %>} phx-update="ignore">
14+
<.error :if={<%= "@changeset.action" %>}>Oops, something went wrong! Please check the errors below.</.error>
15+
<.input field={<%= "f[\#{__user_id_field__("@changeset", :key)}]" %>} type={<%= __user_id_field__("@changeset", :type) %>} label={<%= __user_id_field__("@changeset", :label) %>} required />
16+
17+
<:actions>
18+
<.button phx-disable-with="Registering..." class="w-full">
19+
Register <span aria-hidden="true">→</span>
20+
</.button>
21+
</:actions>
22+
</.simple_form>
23+
</div>
24+
"""
25+
else
26+
# TODO: Remove when Phoenix 1.7 required
27+
template :add_user_id, :html,
28+
"""
29+
<h2>Register</h2>
30+
31+
<%= render_form([
32+
{:text, {:changeset, :pow_user_id_field}}
33+
]) %>
34+
"""
35+
end
36+
end

lib/pow_assent/phoenix/templates/registration_template.ex

Lines changed: 0 additions & 13 deletions
This file was deleted.

lib/pow_assent/phoenix/views/registration_view.ex

Lines changed: 0 additions & 4 deletions
This file was deleted.

mix.exs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule PowAssent.MixProject do
77
[
88
app: :pow_assent,
99
version: @version,
10-
elixir: "~> 1.11",
10+
elixir: "~> 1.12",
1111
elixirc_paths: elixirc_paths(Mix.env()),
1212
start_permanent: Mix.env() == :prod,
1313
compilers: Mix.compilers(),
@@ -31,13 +31,14 @@ defmodule PowAssent.MixProject do
3131

3232
defp deps do
3333
[
34-
{:pow, "~> 1.0.28"},
34+
{:pow, "~> 1.0.29"},
3535
{:assent, "~> 0.1.2 or ~> 0.2.0"},
3636

3737
{:ecto, "~> 2.2 or ~> 3.0"},
3838
{:phoenix, ">= 1.3.0 and < 1.8.0"},
3939
{:phoenix_html, ">= 2.0.0 and <= 4.0.0"},
4040
{:plug, ">= 1.5.0 and < 2.0.0", optional: true},
41+
{:phoenix_live_view, ">= 0.18.0", optional: true},
4142

4243
{:phoenix_ecto, "~> 4.0", only: [:dev, :test]},
4344
{:credo, "~> 1.1", only: [:dev, :test]},
@@ -47,6 +48,7 @@ defmodule PowAssent.MixProject do
4748

4849
{:ecto_sql, "~> 3.1", only: :test},
4950
{:postgrex, "~> 0.14", only: :test},
51+
{:floki, ">= 0.30.0", only: :test},
5052
{:ssl_verify_fun, "~> 1.1", only: :test},
5153
{:test_server, "~> 0.1.0", only: :test}
5254
]

mix.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"ecto_sql": {:hex, :ecto_sql, "3.9.2", "34227501abe92dba10d9c3495ab6770e75e79b836d114c41108a4bf2ce200ad5", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.2", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1eb5eeb4358fdbcd42eac11c1fbd87e3affd7904e639d77903c1358b2abd3f70"},
1515
"ex_doc": {:hex, :ex_doc, "0.29.3", "f07444bcafb302db86e4f02d8bbcd82f2e881a0dcf4f3e4740e4b8128b9353f7", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3dc6787d7b08801ec3b51e9bd26be5e8826fbf1a17e92d1ebc252e1a1c75bfe1"},
1616
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
17+
"floki": {:hex, :floki, "0.34.2", "5fad07ef153b3b8ec110b6b155ec3780c4b2c4906297d0b4be1a7162d04a7e02", [:mix], [], "hexpm", "26b9d50f0f01796bc6be611ca815c5e0de034d2128e39cc9702eee6b66a4d1c8"},
1718
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
1819
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
1920
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
@@ -23,14 +24,15 @@
2324
"phoenix": {:hex, :phoenix, "1.7.2", "c375ffb482beb4e3d20894f84dd7920442884f5f5b70b9f4528cbe0cedefec63", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.4", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "1ebca94b32b4d0e097ab2444a9742ed8ff3361acad17365e4e6b2e79b4792159"},
2425
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"},
2526
"phoenix_html": {:hex, :phoenix_html, "3.3.1", "4788757e804a30baac6b3fc9695bf5562465dd3f1da8eb8460ad5b404d9a2178", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "bed1906edd4906a15fd7b412b85b05e521e1f67c9a85418c55999277e553d0d3"},
27+
"phoenix_live_view": {:hex, :phoenix_live_view, "0.18.18", "1f38fbd7c363723f19aad1a04b5490ff3a178e37daaf6999594d5f34796c47fc", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a5810d0472f3189ede6d2a95bda7f31c6113156b91784a3426cb0ab6a6d85214"},
2628
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
2729
"phoenix_template": {:hex, :phoenix_template, "1.0.1", "85f79e3ad1b0180abb43f9725973e3b8c2c3354a87245f91431eec60553ed3ef", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "157dc078f6226334c91cb32c1865bf3911686f8bcd6bcff86736f6253e6993ee"},
2830
"phoenix_view": {:hex, :phoenix_view, "2.0.2", "6bd4d2fd595ef80d33b439ede6a19326b78f0f1d8d62b9a318e3d9c1af351098", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "a929e7230ea5c7ee0e149ffcf44ce7cf7f4b6d2bfe1752dd7c084cdff152d36f"},
2931
"plug": {:hex, :plug, "1.14.1", "3148623796853ae96c628960b833bf6b6a894d6bdc8c199ef7160c41149b71f2", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a0e789be21a576b11ec55a0983e4e8f7c7b07d88dfb3b8da9e97767132271d40"},
3032
"plug_cowboy": {:hex, :plug_cowboy, "2.6.0", "d1cf12ff96a1ca4f52207c5271a6c351a4733f413803488d75b70ccf44aebec2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "073cf20b753ce6682ed72905cd62a2d4bd9bad1bf9f7feb02a1b8e525bd94fa6"},
3133
"plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"},
3234
"postgrex": {:hex, :postgrex, "0.16.5", "fcc4035cc90e23933c5d69a9cd686e329469446ef7abba2cf70f08e2c4b69810", [:mix], [{:connection, "~> 1.1", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "edead639dc6e882618c01d8fc891214c481ab9a3788dfe38dd5e37fd1d5fb2e8"},
33-
"pow": {:hex, :pow, "1.0.28", "b2cc32673e3fd138db6bd7e0656d826b287800d60f4139ed3c3fa6df926f1250", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.3.0 and < 1.8.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 2.0.0 and < 4.0.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, ">= 1.5.0 and < 2.0.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "e03f6ae9a536153f8491e3ef7bb0908f5494756905997611abb204ce23b4d64d"},
35+
"pow": {:hex, :pow, "1.0.29", "9c387059af028500a339e7a334103739245dd508d2e18c41e0fcb20e4b40f02f", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.3.0 and < 1.8.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 2.0.0 and < 4.0.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, ">= 0.18.0", [hex: :phoenix_live_view, repo: "hexpm", optional: true]}, {:plug, ">= 1.5.0 and < 2.0.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "94097ad2b79e4c44733344e04653ea424b4cbbae700ab2fa7d069d9f00364be7"},
3436
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
3537
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
3638
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},

test/mix/tasks/phoenix/pow_assent.phoenix.gen.templates_test.exs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,34 @@ defmodule Mix.Tasks.PowAssent.Phoenix.Gen.TemplatesTest do
44
alias Mix.Tasks.PowAssent.Phoenix.Gen.Templates
55

66
@expected_template_files %{
7-
"registration" => ["add_user_id.html.eex"]
7+
"registration_html" => ["add_user_id.html.heex"]
88
}
9-
@expected_views Map.keys(@expected_template_files)
109

1110
test "generates templates", context do
1211
File.cd!(context.tmp_path, fn ->
1312
Templates.run([])
1413

15-
templates_path = Path.join(["lib", "pow_assent_web", "templates", "pow_assent"])
14+
templates_path = Path.join(["lib", "pow_assent_web", "controllers", "pow_assent"])
1615
expected_dirs = Map.keys(@expected_template_files)
16+
expected_files = Enum.map(expected_dirs, &"#{&1}.ex")
1717

18-
assert ls(templates_path) == expected_dirs
18+
assert expected_dirs -- ls(templates_path) == []
19+
assert expected_files -- ls(templates_path) == []
1920

2021
for {dir, expected_files} <- @expected_template_files do
2122
files = templates_path |> Path.join(dir) |> ls()
22-
assert files == expected_files
23+
24+
assert expected_files -- files == []
2325
end
2426

25-
views_path = Path.join(["lib", "pow_assent_web", "views", "pow_assent"])
26-
expected_view_files = Enum.map(@expected_views, &"#{&1}_view.ex")
27-
view_content = views_path |> Path.join("registration_view.ex") |> File.read!()
27+
for base_name <- expected_dirs do
28+
content = templates_path |> Path.join(base_name <> ".ex") |> File.read!()
29+
module_name = base_name |> Macro.camelize() |> String.replace_suffix("Html", "HTML")
2830

29-
assert ls(views_path) == expected_view_files
30-
assert view_content =~ "defmodule PowAssentWeb.PowAssent.RegistrationView do"
31-
assert view_content =~ "use PowAssentWeb, :view"
31+
assert content =~ "defmodule PowAssentWeb.PowAssent.#{module_name} do"
32+
assert content =~ "use PowAssentWeb, :html"
33+
assert content =~ "embed_templates \"#{base_name}/*\""
34+
end
3235
end)
3336
end
3437

test/mix/tasks/phoenix/pow_assent.phoenix.install_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ defmodule Mix.Tasks.PowAssent.Phoenix.InstallTest do
114114
Install.run(options)
115115

116116
assert File.exists?(context.paths.templates_path)
117-
assert [_one] = File.ls!(context.paths.templates_path)
117+
assert [_one, _two] = File.ls!(context.paths.templates_path)
118118
end)
119119
end
120120

0 commit comments

Comments
 (0)