Skip to content

Commit 3f7d3a6

Browse files
authored
Merge pull request #18 from danschultzer/phoenix-1.4
Add support for Phoenix 1.4
2 parents 63aa729 + f486498 commit 3f7d3a6

File tree

11 files changed

+68
-51
lines changed

11 files changed

+68
-51
lines changed

config/test.exs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ for extension <- [PowEmailConfirmation, PowResetPassword, PowPersistentSession]
3030
extensions: [extension],
3131
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks
3232
end
33+
34+
config :phoenix, :json_library, Jason

lib/pow/phoenix/html/bootstrap.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defmodule Pow.Phoenix.HTML.Bootstrap do
2+
# TODO: Remove module by 1.1.0 and only support Phoenix 1.4.0
3+
24
@moduledoc """
35
Module that helps build HTML for Phoenix with Bootstrap CSS.
46
"""

lib/pow/phoenix/html/form_template.ex

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ defmodule Pow.Phoenix.HTML.FormTemplate do
22
@moduledoc """
33
Module that can build user form templates for Phoenix.
44
5-
This module is build to support Phoenix 1.4 with minimalist CSS. Another
6-
module `Pow.Phoenix.HTML.Bootstrap` exists to ensure Phoenix 1.3 templates
7-
can be rendered with Bootstrap CSS classes. This is the default behaviour
8-
until Phoenix 1.4 is released.
5+
For Phoenix 1.3, or bootstrap templates, `Pow.Phoenix.HTML.Bootstrap` can be
6+
used.
97
"""
108
alias Pow.Phoenix.HTML.Bootstrap
119

@@ -34,18 +32,26 @@ defmodule Pow.Phoenix.HTML.FormTemplate do
3432
## Options
3533
3634
* `:button_label` - the submit button label, defaults to "Submit".
37-
* `:bootstrap` - to render form as bootstrap, defaults to true.
35+
* `:bootstrap` - to render form as bootstrap, defaults to false with
36+
phoenix 1.4 and true with phoenix 1.3.
3837
"""
3938
@spec render(list(), Keyword.t()) :: Macro.t()
4039
def render(inputs, opts \\ []) do
4140
button_label = Keyword.get(opts, :button_label, "Submit")
4241

43-
case Keyword.get(opts, :bootstrap, true) do
42+
case bootstrap?(opts) do
4443
true -> Bootstrap.render_form(inputs, button_label)
4544
_any -> render_form(inputs, button_label)
4645
end
4746
end
4847

48+
# TODO: Remove bootstrap support by 1.1.0 and only support Phoenix 1.4.0
49+
defp bootstrap?(opts) do
50+
bootstrap = Pow.dependency_vsn_match?(:phoenix, "~> 1.3.0")
51+
52+
Keyword.get(opts, :bootstrap, bootstrap)
53+
end
54+
4955
defp render_form(inputs, button_label) do
5056
inputs = for {type, key} <- inputs, do: input(type, key)
5157

mix.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule Pow.MixProject do
3636
defp deps do
3737
[
3838
{:ecto, "~> 2.2 or ~> 3.0"},
39-
{:phoenix, "~> 1.3.0"},
39+
{:phoenix, "~> 1.3.0 or ~> 1.4.0"},
4040
{:phoenix_html, ">= 2.0.0 and <= 3.0.0"},
4141
{:plug, ">= 1.5.0 and < 1.8.0", optional: true},
4242

@@ -46,6 +46,8 @@ defmodule Pow.MixProject do
4646
{:ex_doc, "~> 0.19.0", only: :dev},
4747

4848
{:ecto_sql, "~> 3.0.0", only: [:test]},
49+
{:plug_cowboy, "~> 2.0", only: [:test]},
50+
{:jason, "~> 1.0", only: [:test]},
4951
{:postgrex, "~> 0.14.0", only: [:test]}
5052
]
5153
end

mix.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
%{
22
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
33
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
4+
"cowboy": {:hex, :cowboy, "2.5.0", "4ef3ae066ee10fe01ea3272edc8f024347a0d3eb95f6fbb9aed556dacbfc1337", [:rebar3], [{:cowlib, "~> 2.6.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.6.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
5+
"cowlib": {:hex, :cowlib, "2.6.0", "8aa629f81a0fc189f261dc98a42243fa842625feea3c7ec56c48f4ccdb55490f", [:rebar3], [], "hexpm"},
46
"credo": {:hex, :credo, "0.9.3", "76fa3e9e497ab282e0cf64b98a624aa11da702854c52c82db1bf24e54ab7c97a", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
57
"db_connection": {:hex, :db_connection, "2.0.1", "09454c6c6e8e4295f400b72580b19f0ac68fda2602e209533285206cb99bee6b", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"},
68
"decimal": {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], [], "hexpm"},
79
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"},
810
"ecto": {:hex, :ecto, "3.0.1", "a26605ee7b243a754e6609d1c23da27bcb22823659b07bf03f9020da92a8e4f4", [:mix], [{:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"},
911
"ecto_sql": {:hex, :ecto_sql, "3.0.0", "8d1883376bee02a0e76b5ef797e39d04333c34b9935d0b4785dbf3cbdb571e2a", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.9.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.14.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.2.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
1012
"ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
13+
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
1114
"makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
1215
"makeup_elixir": {:hex, :makeup_elixir, "0.10.0", "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], [{:makeup, "~> 0.5.5", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
1316
"mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], [], "hexpm"},
1417
"nimble_parsec": {:hex, :nimble_parsec, "0.4.0", "ee261bb53214943679422be70f1658fff573c5d0b0a1ecd0f18738944f818efe", [:mix], [], "hexpm"},
15-
"phoenix": {:hex, :phoenix, "1.3.4", "aaa1b55e5523083a877bcbe9886d9ee180bf2c8754905323493c2ac325903dc5", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
18+
"phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"},
1619
"phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
1720
"phoenix_html": {:hex, :phoenix_html, "2.12.0", "1fb3c2e48b4b66d75564d8d63df6d53655469216d6b553e7e14ced2b46f97622", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
1821
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.1", "6668d787e602981f24f17a5fbb69cc98f8ab085114ebfac6cc36e10a90c8e93c", [:mix], [], "hexpm"},
1922
"plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}], "hexpm"},
23+
"plug_cowboy": {:hex, :plug_cowboy, "2.0.0", "ab0c92728f2ba43c544cce85f0f220d8d30fc0c90eaa1e6203683ab039655062", [:mix], [{:cowboy, "~> 2.5", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
2024
"plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"},
2125
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
2226
"postgrex": {:hex, :postgrex, "0.14.0", "f3d6ffea1ca8a156e0633900a5338a3d17b00435227726baed8982718232b694", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"},
27+
"ranch": {:hex, :ranch, "1.6.2", "6db93c78f411ee033dbb18ba8234c5574883acb9a75af0fb90a9b82ea46afa00", [:rebar3], [], "hexpm"},
2328
"telemetry": {:hex, :telemetry, "0.2.0", "5b40caa3efe4deb30fb12d7cd8ed4f556f6d6bd15c374c2366772161311ce377", [:mix], [], "hexpm"},
2429
}

test/extensions/reset_password/phoenix/controllers/reset_password_controller_test.exs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do
1212
conn = get(conn, Routes.pow_reset_password_reset_password_path(conn, :new))
1313

1414
assert html = html_response(conn, 200)
15-
assert html =~ "<label class=\"control-label\" for=\"user_email\">Email</label>"
16-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\">"
15+
assert html =~ "<label for=\"user_email\">Email</label>"
16+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\">"
1717
end
1818

1919
test "already signed in", %{conn: conn} do
@@ -90,10 +90,10 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do
9090
conn = get conn, Routes.pow_reset_password_reset_password_path(conn, :edit, @valid_token)
9191

9292
assert html = html_response(conn, 200)
93-
assert html =~ "<label class=\"control-label\" for=\"user_password\">Password</label>"
94-
assert html =~ "<input class=\"form-control\" id=\"user_password\" name=\"user[password]\" type=\"password\">"
95-
assert html =~ "<label class=\"control-label\" for=\"user_confirm_password\">Confirm password</label>"
96-
assert html =~ "<input class=\"form-control\" id=\"user_confirm_password\" name=\"user[confirm_password]\" type=\"password\">"
93+
assert html =~ "<label for=\"user_password\">Password</label>"
94+
assert html =~ "<input id=\"user_password\" name=\"user[password]\" type=\"password\">"
95+
assert html =~ "<label for=\"user_confirm_password\">Confirm password</label>"
96+
assert html =~ "<input id=\"user_confirm_password\" name=\"user[confirm_password]\" type=\"password\">"
9797
assert html =~ "<a href=\"/session/new\">Sign in</a>"
9898
end
9999
end
@@ -140,8 +140,8 @@ defmodule PowResetPassword.Phoenix.ResetPasswordControllerTest do
140140
conn = put conn, Routes.pow_reset_password_reset_password_path(conn, :update, @valid_token, @invalid_params)
141141

142142
assert html = html_response(conn, 200)
143-
assert html =~ "<label class=\"control-label\" for=\"user_password\">Password</label>"
144-
assert html =~ "<input class=\"form-control\" id=\"user_password\" name=\"user[password]\" type=\"password\">"
143+
assert html =~ "<label for=\"user_password\">Password</label>"
144+
assert html =~ "<input id=\"user_password\" name=\"user[password]\" type=\"password\">"
145145
assert html =~ "<span class=\"help-block\">not same as password</span>"
146146

147147
changeset = conn.assigns[:changeset]

test/pow/phoenix/controllers/registration_controller_test.exs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ defmodule Pow.Phoenix.RegistrationControllerTest do
88

99
assert html = html_response(conn, 200)
1010
assert html =~ Routes.pow_registration_path(conn, :create)
11-
assert html =~ "<label class=\"control-label\" for=\"user_email\">Email</label>"
12-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\">"
13-
assert html =~ "<label class=\"control-label\" for=\"user_password\">Password</label>"
14-
assert html =~ "<input class=\"form-control\" id=\"user_password\" name=\"user[password]\" type=\"password\">"
15-
assert html =~ "<label class=\"control-label\" for=\"user_confirm_password\">Confirm password</label>"
16-
assert html =~ "<input class=\"form-control\" id=\"user_confirm_password\" name=\"user[confirm_password]\" type=\"password\">"
11+
assert html =~ "<label for=\"user_email\">Email</label>"
12+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\">"
13+
assert html =~ "<label for=\"user_password\">Password</label>"
14+
assert html =~ "<input id=\"user_password\" name=\"user[password]\" type=\"password\">"
15+
assert html =~ "<label for=\"user_confirm_password\">Confirm password</label>"
16+
assert html =~ "<input id=\"user_confirm_password\" name=\"user[confirm_password]\" type=\"password\">"
1717
assert html =~ "<a href=\"/session/new\">Sign in</a>"
1818
end
1919

@@ -51,9 +51,9 @@ defmodule Pow.Phoenix.RegistrationControllerTest do
5151
test "with invalid params", %{conn: conn} do
5252
conn = post conn, Routes.pow_registration_path(conn, :create, @invalid_params)
5353
assert html = html_response(conn, 200)
54-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
55-
assert html =~ "<label class=\"control-label\" for=\"user_password\">Password</label>"
56-
assert html =~ "<input class=\"form-control\" id=\"user_password\" name=\"user[password]\" type=\"password\">"
54+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
55+
assert html =~ "<label for=\"user_password\">Password</label>"
56+
assert html =~ "<input id=\"user_password\" name=\"user[password]\" type=\"password\">"
5757
assert html =~ "<span class=\"help-block\">should be at least 10 character(s)</span>"
5858
assert errors = conn.assigns[:changeset].errors
5959
assert errors[:password]
@@ -70,10 +70,10 @@ defmodule Pow.Phoenix.RegistrationControllerTest do
7070
|> get(Routes.pow_registration_path(conn, :edit))
7171

7272
assert html = html_response(conn, 200)
73-
assert html =~ "<label class=\"control-label\" for=\"user_email\">Email</label>"
74-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
75-
assert html =~ "<label class=\"control-label\" for=\"user_current_password\">Current password</label>"
76-
assert html =~ "<input class=\"form-control\" id=\"user_current_password\" name=\"user[current_password]\" type=\"password\">"
73+
assert html =~ "<label for=\"user_email\">Email</label>"
74+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
75+
assert html =~ "<label for=\"user_current_password\">Current password</label>"
76+
assert html =~ "<input id=\"user_current_password\" name=\"user[current_password]\" type=\"password\">"
7777
end
7878

7979
test "not signed in", %{conn: conn} do
@@ -113,10 +113,10 @@ defmodule Pow.Phoenix.RegistrationControllerTest do
113113
conn = put(conn, Routes.pow_registration_path(conn, :update, @invalid_params))
114114

115115
assert html = html_response(conn, 200)
116-
assert html =~ "<label class=\"control-label\" for=\"user_email\">Email</label>"
117-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
118-
assert html =~ "<label class=\"control-label\" for=\"user_current_password\">Current password</label>"
119-
assert html =~ "<input class=\"form-control\" id=\"user_current_password\" name=\"user[current_password]\" type=\"password\">"
116+
assert html =~ "<label for=\"user_email\">Email</label>"
117+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
118+
assert html =~ "<label for=\"user_current_password\">Current password</label>"
119+
assert html =~ "<input id=\"user_current_password\" name=\"user[current_password]\" type=\"password\">"
120120
assert html =~ "<span class=\"help-block\">can&#39;t be blank</span>"
121121
assert errors = conn.assigns[:changeset].errors
122122
assert errors[:current_password]

test/pow/phoenix/controllers/session_controller_test.exs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ defmodule Pow.Phoenix.SessionControllerTest do
1818
assert html = html_response(conn, 200)
1919
assert html =~ Routes.pow_session_path(conn, :create)
2020
refute html =~ "request_path="
21-
assert html =~ "<label class=\"control-label\" for=\"user_email\">Email</label>"
22-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\">"
23-
assert html =~ "<label class=\"control-label\" for=\"user_password\">Password</label>"
24-
assert html =~ "<input class=\"form-control\" id=\"user_password\" name=\"user[password]\" type=\"password\">"
21+
assert html =~ "<label for=\"user_email\">Email</label>"
22+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\">"
23+
assert html =~ "<label for=\"user_password\">Password</label>"
24+
assert html =~ "<input id=\"user_password\" name=\"user[password]\" type=\"password\">"
2525
assert html =~ "<a href=\"/registration/new\">Register</a>"
2626
end
2727

@@ -58,8 +58,8 @@ defmodule Pow.Phoenix.SessionControllerTest do
5858
conn = post conn, Routes.pow_session_path(conn, :create, @invalid_params)
5959
assert html = html_response(conn, 200)
6060
assert get_flash(conn, :error) == "The provided login details did not work. Please verify your credentials, and try again."
61-
assert html =~ "<input class=\"form-control\" id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
62-
assert html =~ "<input class=\"form-control\" id=\"user_password\" name=\"user[password]\" type=\"password\">"
61+
assert html =~ "<input id=\"user_email\" name=\"user[email]\" type=\"text\" value=\"[email protected]\">"
62+
assert html =~ "<input id=\"user_password\" name=\"user[password]\" type=\"password\">"
6363
refute Plug.current_user(conn)
6464
refute conn.private[:plug_session]["auth"]
6565
refute html =~ "request_path"

test/pow/phoenix/html/form_template_test.exs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ defmodule Pow.Phoenix.HTML.FormTemplateTest do
44

55
alias Pow.Phoenix.HTML.FormTemplate
66

7-
test "render/2 with bootstrap" do
7+
test "render/2 with minimalist" do
88
html = FormTemplate.render([
99
{:text, {:changeset, :pow_user_id_field}},
1010
{:password, :password},
1111
{:password, :confirm_password}
12-
], bootstrap: true)
12+
])
1313

14-
assert html =~ "<div class=\"form-group\">"
15-
assert html =~ "<%= label f, :password, class: \"control-label\" %>"
16-
assert html =~ "<%= password_input f, :password, class: \"form-control\" %>"
14+
refute html =~ "<div class=\"form-group\">"
15+
assert html =~ "<%= label f, :password %>"
16+
assert html =~ "<%= password_input f, :password %>"
1717
assert html =~ "<%= error_tag f, :password %>"
1818
end
1919

20-
test "render/2 with minimalist" do
20+
test "render/2 with bootstrap" do
2121
html = FormTemplate.render([
2222
{:text, {:changeset, :pow_user_id_field}},
2323
{:password, :password},
2424
{:password, :confirm_password}
25-
], bootstrap: false)
25+
], bootstrap: true)
2626

27-
refute html =~ "<div class=\"form-group\">"
28-
assert html =~ "<%= label f, :password %>"
29-
assert html =~ "<%= password_input f, :password %>"
27+
assert html =~ "<div class=\"form-group\">"
28+
assert html =~ "<%= label f, :password, class: \"control-label\" %>"
29+
assert html =~ "<%= password_input f, :password, class: \"form-control\" %>"
3030
assert html =~ "<%= error_tag f, :password %>"
3131
end
3232
end

test/support/extensions/mock.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ defmodule Pow.Test.ExtensionMocks do
5959
plug Plug.Parsers,
6060
parsers: [:urlencoded, :multipart, :json],
6161
pass: ["*/*"],
62-
json_decoder: Poison
62+
json_decoder: Phoenix.json_library()
6363

6464
plug Plug.MethodOverride
6565
plug Plug.Head

0 commit comments

Comments
 (0)