-
\ No newline at end of file
+
diff --git a/lib/fitness_web/templates/user_confirmation/edit.html.heex b/lib/fitness_web/templates/user_confirmation/edit.html.heex
index e9bf443..32199d4 100644
--- a/lib/fitness_web/templates/user_confirmation/edit.html.heex
+++ b/lib/fitness_web/templates/user_confirmation/edit.html.heex
@@ -1,12 +1,18 @@
-<.form let={_f} for={:user} action={Routes.user_confirmation_path(@conn, :update, @token)}>
+<.form
+ :let={_f}
+ for={%{}}
+ as={:user}
+ action={Routes.user_confirmation_path(@conn, :update, @token)}
+>
- <%= submit "Confirm my account" %>
+ <%= submit("Confirm my account") %>
- <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> |
- <%= link "Log in", to: Routes.user_session_path(@conn, :new) %>
+ <%= link("Register", to: Routes.user_registration_path(@conn, :new)) %> | <%= link("Log in",
+ to: Routes.user_session_path(@conn, :new)
+ ) %>
diff --git a/lib/fitness_web/templates/user_confirmation/new.html.heex b/lib/fitness_web/templates/user_confirmation/new.html.heex
index 4d9bee3..5cfec84 100644
--- a/lib/fitness_web/templates/user_confirmation/new.html.heex
+++ b/lib/fitness_web/templates/user_confirmation/new.html.heex
@@ -1,15 +1,16 @@
-<.form let={f} for={:user} action={Routes.user_confirmation_path(@conn, :create)}>
- <%= label f, :email %>
- <%= email_input f, :email, required: true %>
+<.form :let={f} for={%{}} as={:user} action={Routes.user_confirmation_path(@conn, :create)}>
+ <%= label(f, :email) %>
+ <%= email_input(f, :email, required: true) %>
- <%= submit "Resend confirmation instructions" %>
+ <%= submit("Resend confirmation instructions") %>
- <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> |
- <%= link "Log in", to: Routes.user_session_path(@conn, :new) %>
+ <%= link("Register", to: Routes.user_registration_path(@conn, :new)) %> | <%= link("Log in",
+ to: Routes.user_session_path(@conn, :new)
+ ) %>
diff --git a/lib/fitness_web/templates/user_registration/new.html.heex b/lib/fitness_web/templates/user_registration/new.html.heex
index af4fb3c..4e03bd4 100644
--- a/lib/fitness_web/templates/user_registration/new.html.heex
+++ b/lib/fitness_web/templates/user_registration/new.html.heex
@@ -1,50 +1,73 @@
-
-
diff --git a/lib/fitness_web/templates/user_session/new.html.heex b/lib/fitness_web/templates/user_session/new.html.heex
index 5948b6d..e38440c 100644
--- a/lib/fitness_web/templates/user_session/new.html.heex
+++ b/lib/fitness_web/templates/user_session/new.html.heex
@@ -1,38 +1,64 @@
-
-
diff --git a/lib/fitness_web/templates/user_settings/edit.html.heex b/lib/fitness_web/templates/user_settings/edit.html.heex
index b2386a4..f2adb3f 100644
--- a/lib/fitness_web/templates/user_settings/edit.html.heex
+++ b/lib/fitness_web/templates/user_settings/edit.html.heex
@@ -1,73 +1,114 @@
-
-
-
-
+
+
+
# Change email
-
# Change email
-
- <.form let={f} for={@email_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_email">
+ <.form
+ :let={f}
+ for={@email_changeset}
+ action={Routes.user_settings_path(@conn, :update)}
+ id="update_email"
+ >
<%= if @email_changeset.action do %>
-
-
Oops, something went wrong! Please check the errors below.
-
+
+
Oops, something went wrong! Please check the errors below.
+
<% end %>
-
- <%= hidden_input f, :action, name: "action", value: "update_email" %>
+
+ <%= hidden_input(f, :action, name: "action", value: "update_email") %>
- <%= label f, :email, class: "text-sm font-poppins font-medium" %>
- <%= email_input f, :email, required: true, class: "form-input rounded-md font-poppins shadow-sm block w-full" %>
- <%= error_tag f, :email %>
+ <%= label(f, :email, class: "text-sm font-poppins font-medium") %>
+ <%= email_input(f, :email,
+ required: true,
+ class: "form-input rounded-md font-poppins shadow-sm block w-full"
+ ) %>
+ <%= error_tag(f, :email) %>
-
+
- <%= label f, :current_password, for: "current_password_for_email", class: "text-sm font-poppins font-medium" %>
- <%= password_input f, :current_password, required: true, name: "current_password", placeholder: "********", id: "current_password_for_email", class: "form-input font-poppins rounded-md shadow-sm block w-full" %>
- <%= error_tag f, :current_password %>
+ <%= label(f, :current_password,
+ for: "current_password_for_email",
+ class: "text-sm font-poppins font-medium"
+ ) %>
+ <%= password_input(f, :current_password,
+ required: true,
+ name: "current_password",
+ placeholder: "********",
+ id: "current_password_for_email",
+ class: "form-input font-poppins rounded-md shadow-sm block w-full"
+ ) %>
+ <%= error_tag(f, :current_password) %>
-
-
- <%= submit "Change email", class: "w-full font-poppins px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gradient-to-r from-purple-400 to-pink-600 hover:from-purple-500 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
-
-
-
+
+
+ <%= submit("Change email",
+ class:
+ "w-full font-poppins px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gradient-to-r from-purple-400 to-pink-600 hover:from-purple-500 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
+ ) %>
+
+
+
-
-
+
+
+
# Change password
-
-
# Change password
-
- <.form let={f} for={@password_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_password">
- <%= if @password_changeset.action do %>
-
-
Oops, something went wrong! Please check the errors below.
-
- <% end %>
-
- <%= hidden_input f, :action, name: "action", value: "update_password" %>
-
- <%= label f, :password, "New password", class: "text-sm font-poppins font-medium" %>
- <%= password_input f, :password, required: true, placeholder: "********", class: "form-input font-poppins rounded-md shadow-sm block w-full" %>
- <%= error_tag f, :password %>
-
+ <.form
+ :let={f}
+ for={@password_changeset}
+ action={Routes.user_settings_path(@conn, :update)}
+ id="update_password"
+ >
+ <%= if @password_changeset.action do %>
+
+
Oops, something went wrong! Please check the errors below.
+
+ <% end %>
-
- <%= label f, :password_confirmation, "Confirm new password", class: "text-sm font-poppins font-medium" %>
- <%= password_input f, :password_confirmation, required: true, placeholder: "********", class: "form-input font-poppins rounded-md shadow-sm block w-full" %>
- <%= error_tag f, :password_confirmation %>
-
-
-
- <%= label f, :current_password, for: "current_password_for_password", class: "text-sm font-poppins font-medium" %>
- <%= password_input f, :current_password, required: true, placeholder: "********", class: "form-input font-poppins font-poppins rounded-md shadow-sm block w-full", name: "current_password", id: "current_password_for_password" %>
- <%= error_tag f, :current_password %>
-
-
-
- <%= submit "Change password", class: "w-full font-poppins px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gradient-to-r from-purple-400 to-pink-600 hover:from-purple-500 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
-
-
-
+ <%= hidden_input(f, :action, name: "action", value: "update_password") %>
+
+ <%= label(f, :password, "New password", class: "text-sm font-poppins font-medium") %>
+ <%= password_input(f, :password,
+ required: true,
+ placeholder: "********",
+ class: "form-input font-poppins rounded-md shadow-sm block w-full"
+ ) %>
+ <%= error_tag(f, :password) %>
+
+
+
+ <%= label(f, :password_confirmation, "Confirm new password",
+ class: "text-sm font-poppins font-medium"
+ ) %>
+ <%= password_input(f, :password_confirmation,
+ required: true,
+ placeholder: "********",
+ class: "form-input font-poppins rounded-md shadow-sm block w-full"
+ ) %>
+ <%= error_tag(f, :password_confirmation) %>
+
+
+
+ <%= label(f, :current_password,
+ for: "current_password_for_password",
+ class: "text-sm font-poppins font-medium"
+ ) %>
+ <%= password_input(f, :current_password,
+ required: true,
+ placeholder: "********",
+ class: "form-input font-poppins font-poppins rounded-md shadow-sm block w-full",
+ name: "current_password",
+ id: "current_password_for_password"
+ ) %>
+ <%= error_tag(f, :current_password) %>
+
+
+
+ <%= submit("Change password",
+ class:
+ "w-full font-poppins px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gradient-to-r from-purple-400 to-pink-600 hover:from-purple-500 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
+ ) %>
+
+
+
-
\ No newline at end of file
diff --git a/mix.exs b/mix.exs
index 4113d88..0e13fee 100644
--- a/mix.exs
+++ b/mix.exs
@@ -34,15 +34,16 @@ defmodule Fitness.MixProject do
defp deps do
[
{:bcrypt_elixir, "~> 3.0"},
- {:phoenix, "~> 1.6.15"},
+ {:phoenix, "~> 1.7.0"},
+ {:phoenix_view, "~> 2.0"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.6"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
- {:phoenix_live_view, "~> 0.17.5"},
+ {:phoenix_live_view, "~> 0.19.0"},
{:floki, ">= 0.30.0", only: :test},
- {:phoenix_live_dashboard, "~> 0.6"},
+ {:phoenix_live_dashboard, "~> 0.8"},
{:esbuild, "~> 0.4", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.3"},
{:telemetry_metrics, "~> 0.6"},
diff --git a/mix.lock b/mix.lock
index 2ced981..c715225 100644
--- a/mix.lock
+++ b/mix.lock
@@ -1,17 +1,17 @@
%{
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"},
- "castore": {:hex, :castore, "1.0.1", "240b9edb4e9e94f8f56ab39d8d2d0a57f49e46c56aced8f873892df8ff64ff5a", [:mix], [], "hexpm", "b4951de93c224d44fac71614beabd88b71932d0b1dea80d2f80fb9044e01bbb3"},
+ "castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"},
"chartkick": {:hex, :chartkick, "1.0.0", "8f640a746ebb90f5975ad0096da872023bc5c9ccf5d6d5654c4fed11c32b9686", [:mix], [{:elixir_uuid, "~> 1.2", [hex: :elixir_uuid, repo: "hexpm", optional: false]}], "hexpm", "219e4b95a9b89723a2155ba0f4928c4789a6f67a49d478f3fa9f92793c37231a"},
"comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
- "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
+ "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
- "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
+ "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"},
"db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
- "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
+ "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"earmark": {:hex, :earmark, "1.4.37", "56ce845c543393aa3f9b294c818c3d783452a4a67e4ab18c4303a954a8b59363", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "d86d5e12868db86d5321b00e62a4bbcb4150346e4acc9a90a041fb188a5cb106"},
"earmark_parser": {:hex, :earmark_parser, "1.4.31", "a93921cdc6b9b869f519213d5bc79d9e218ba768d7270d46fdcf1c01bacff9e2", [:mix], [], "hexpm", "317d367ee0335ef037a87e46c91a2269fef6306413f731e8ec11fc45a7efd059"},
- "ecto": {:hex, :ecto, "3.9.5", "9f0aa7ae44a1577b651c98791c6988cd1b69b21bc724e3fd67090b97f7604263", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d4f3115d8cbacdc0bfa4b742865459fb1371d0715515842a1fb17fe31920b74c"},
+ "ecto": {:hex, :ecto, "3.9.6", "2f420c173efcb2e22fa4f8fc41e75e02b3c5bd4cffef12085cae5418c12e530d", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "df17bc06ba6f78a7b764e4a14ef877fe5f4499332c5a105ace11fe7013b72c84"},
"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"},
"elixir_make": {:hex, :elixir_make, "0.7.6", "67716309dc5d43e16b5abbd00c01b8df6a0c2ab54a8f595468035a50189f9169", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5a0569756b0f7873a77687800c164cca6dfc03a09418e6fcf853d78991f49940"},
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
@@ -21,19 +21,19 @@
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"floki": {:hex, :floki, "0.34.2", "5fad07ef153b3b8ec110b6b155ec3780c4b2c4906297d0b4be1a7162d04a7e02", [:mix], [], "hexpm", "26b9d50f0f01796bc6be611ca815c5e0de034d2128e39cc9702eee6b66a4d1c8"},
"gettext": {:hex, :gettext, "0.22.1", "e7942988383c3d9eed4bdc22fc63e712b655ae94a672a27e4900e3d4a2c43581", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "ad105b8dab668ee3f90c0d3d94ba75e9aead27a62495c101d94f2657a190ac5d"},
- "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
+ "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"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"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
- "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"},
+ "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.0", "9e18a119d9efc3370a3ef2a937bf0b24c088d9c4bf0ba9d7c3751d49d347d035", [:mix], [], "hexpm", "7977f183127a7cbe9346981e2f480dc04c55ffddaef746bd58debd566070eef8"},
- "phoenix": {:hex, :phoenix, "1.6.16", "e5bdd18c7a06da5852a25c7befb72246de4ddc289182285f8685a40b7b5f5451", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [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]}], "hexpm", "e15989ff34f670a96b95ef6d1d25bad0d9c50df5df40b671d8f4a669e050ac39"},
+ "phoenix": {:hex, :phoenix, "1.7.7", "4cc501d4d823015007ba3cdd9c41ecaaf2ffb619d6fb283199fa8ddba89191e0", [: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.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "8966e15c395e5e37591b6ed0bd2ae7f48e961f0f60ac4c733f9566b519453085"},
"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"},
- "phoenix_html": {:hex, :phoenix_html, "3.3.1", "4788757e804a30baac6b3fc9695bf5562465dd3f1da8eb8460ad5b404d9a2178", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "bed1906edd4906a15fd7b412b85b05e521e1f67c9a85418c55999277e553d0d3"},
- "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.6.5", "1495bb014be12c9a9252eca04b9af54246f6b5c1e4cd1f30210cd00ec540cf8e", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.3", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.7", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "ef4fa50dd78364409039c99cf6f98ab5209b4c5f8796c17f4db118324f0db852"},
+ "phoenix_html": {:hex, :phoenix_html, "3.3.2", "d6ce982c6d8247d2fc0defe625255c721fb8d5f1942c5ac051f6177bffa5973f", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "44adaf8e667c1c20fb9d284b6b0fa8dc7946ce29e81ce621860aa7e96de9a11d"},
+ "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.1", "c4f2a2d3b26e6ca684d162ccf18aaeed8bed2181896e0393d0a2959789482e51", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "1ca0f954274ce1916f771f86b3d49a91d3447e7c32d171660676095c5f30abe9"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.4.1", "2aff698f5e47369decde4357ba91fc9c37c6487a512b41732818f2204a8ef1d3", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "9bffb834e7ddf08467fe54ae58b5785507aaba6255568ae22b4d46e2bb3615ab"},
- "phoenix_live_view": {:hex, :phoenix_live_view, "0.17.14", "5ec615d4d61bf9d4755f158bd6c80372b715533fe6d6219e12d74fb5eedbeac1", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.0 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "afeb6ba43ce329a6f7fc1c9acdfc6d3039995345f025febb7f409a92f6faebd3"},
- "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
- "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"},
+ "phoenix_live_view": {:hex, :phoenix_live_view, "0.19.5", "6e730595e8e9b8c5da230a814e557768828fd8dfeeb90377d2d8dbb52d4ec00a", [: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", "b2eaa0dd3cfb9bd7fb949b88217df9f25aed915e986a28ad5c8a0d054e7ca9d3"},
+ "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"},
+ "phoenix_template": {:hex, :phoenix_template, "1.0.3", "32de561eefcefa951aead30a1f94f1b5f0379bc9e340bb5c667f65f1edfa4326", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "16f4b6588a4152f3cc057b9d0c0ba7e82ee23afa65543da535313ad8d25d8e2c"},
"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"},
"plug": {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [: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", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"},
"plug_cowboy": {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [: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", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"},
@@ -46,4 +46,6 @@
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
+ "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
+ "websock_adapter": {:hex, :websock_adapter, "0.5.4", "7af8408e7ed9d56578539594d1ee7d8461e2dd5c3f57b0f2a5352d610ddde757", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "d2c238c79c52cbe223fcdae22ca0bb5007a735b9e933870e241fce66afb4f4ab"},
}
diff --git a/priv/repo/migrations/20230417211058_create_workout_items.exs b/priv/repo/migrations/20230417211058_create_workout_items.exs
index e7caa0e..a32c109 100644
--- a/priv/repo/migrations/20230417211058_create_workout_items.exs
+++ b/priv/repo/migrations/20230417211058_create_workout_items.exs
@@ -9,7 +9,9 @@ defmodule Fitness.Repo.Migrations.CreateWorkoutItems do
add :reps, :integer
add :check_box, :boolean, default: false, null: false
add :exercise_id, references(:exercises, on_delete: :delete_all), null: false
- add :workout_template_id, references(:workout_templates, on_delete: :delete_all), null: false
+
+ add :workout_template_id, references(:workout_templates, on_delete: :delete_all),
+ null: false
timestamps()
end
diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs
index b066dcc..c89db31 100644
--- a/priv/repo/seeds.exs
+++ b/priv/repo/seeds.exs
@@ -13,21 +13,105 @@
alias Fitness.Exercises
alias Fitness.Accounts
-
File.read!("priv/repo/list_of_exercises.txt")
|> :erlang.binary_to_term()
|> Enum.uniq()
|> Enum.each(fn workout -> Exercises.create_exercise(workout) end)
+Accounts.register_user(%{
+ email: "test@test.com",
+ password: "test@test.com",
+ is_admin: true,
+ username: "Admin001",
+ name: "Admin"
+})
+
+Accounts.register_user(%{
+ email: "test@test1.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "puppies-lover",
+ name: "Andervrs",
+ player_score: "1001"
+})
+
+Accounts.register_user(%{
+ email: "test@test2.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "Full-stack-developer",
+ name: "Alfred",
+ player_score: "800"
+})
+
+Accounts.register_user(%{
+ email: "test@test3.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "Captain-America",
+ name: "john",
+ player_score: "1000"
+})
+
+Accounts.register_user(%{
+ email: "test@test4.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "Rhythm-Rider",
+ name: "Einer",
+ player_score: "700"
+})
+
+Accounts.register_user(%{
+ email: "test@test5.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "Richie-Rich",
+ name: "yusef",
+ player_score: "900"
+})
+
+Accounts.register_user(%{
+ email: "test@test6.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "The-Label-Man",
+ name: "eddie",
+ player_score: "10000"
+})
+
+Accounts.register_user(%{
+ email: "test@test7.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "The-Wizard",
+ name: "brook",
+ player_score: "5000"
+})
+
+Accounts.register_user(%{
+ email: "test@test8.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "Albert-Einstein",
+ name: "steve",
+ player_score: "600"
+})
+
+Accounts.register_user(%{
+ email: "test@test9.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "The-Bird-Man",
+ name: "marko",
+ player_score: "500"
+})
-Accounts.register_user(%{email: "test@test.com", password: "test@test.com", is_admin: true, username: "Admin001", name: "Admin"})
-Accounts.register_user(%{email: "test@test1.com", password: "mak12345", is_admin: false, username: "puppies-lover", name: "Andervrs", player_score: "1001"})
-Accounts.register_user(%{email: "test@test2.com", password: "mak12345", is_admin: false, username: "Full-stack-developer", name: "Alfred", player_score: "800"})
-Accounts.register_user(%{email: "test@test3.com", password: "mak12345", is_admin: false, username: "Captain-America", name: "john", player_score: "1000"})
-Accounts.register_user(%{email: "test@test4.com", password: "mak12345", is_admin: false, username: "Rhythm-Rider", name: "Einer", player_score: "700"})
-Accounts.register_user(%{email: "test@test5.com", password: "mak12345", is_admin: false, username: "Richie-Rich", name: "yusef", player_score: "900"})
-Accounts.register_user(%{email: "test@test6.com", password: "mak12345", is_admin: false, username: "The-Label-Man", name: "eddie", player_score: "10000"})
-Accounts.register_user(%{email: "test@test7.com", password: "mak12345", is_admin: false, username: "The-Wizard", name: "brook", player_score: "5000"})
-Accounts.register_user(%{email: "test@test8.com", password: "mak12345", is_admin: false, username: "Albert-Einstein", name: "steve", player_score: "600"})
-Accounts.register_user(%{email: "test@test9.com", password: "mak12345", is_admin: false, username: "The-Bird-Man", name: "marko", player_score: "500"})
-Accounts.register_user(%{email: "test@test10.com", password: "mak12345", is_admin: false, username: "Elixir-Newbie", name: "mohsin",player_score: "2000"})
+Accounts.register_user(%{
+ email: "test@test10.com",
+ password: "mak12345",
+ is_admin: false,
+ username: "Elixir-Newbie",
+ name: "mohsin",
+ player_score: "2000"
+})
diff --git a/test/fitness/accounts_test.exs b/test/fitness/accounts_test.exs
index b5868fc..ea5db29 100644
--- a/test/fitness/accounts_test.exs
+++ b/test/fitness/accounts_test.exs
@@ -59,13 +59,23 @@ defmodule Fitness.AccountsTest do
end
test "validates email and password when given" do
- {:error, changeset} = Accounts.register_user(%{email: "not valid", password: "1", name: "not valid123", username: "not valid"})
+ {:error, changeset} =
+ Accounts.register_user(%{
+ email: "not valid",
+ password: "1",
+ name: "not valid123",
+ username: "not valid"
+ })
assert %{
email: ["must have the @ sign and no spaces"],
password: ["should be at least 6 character(s)"],
- name: ["A name must be made up of only letters and should not include any symbols or numbers."],
- username: ["A username should consist of both letters and numbers, and should not contain any spaces"]
+ name: [
+ "A name must be made up of only letters and should not include any symbols or numbers."
+ ],
+ username: [
+ "A username should consist of both letters and numbers, and should not contain any spaces"
+ ]
} = errors_on(changeset)
end
diff --git a/test/fitness/exercises_test.exs b/test/fitness/exercises_test.exs
index 7349a76..7f0a6b0 100644
--- a/test/fitness/exercises_test.exs
+++ b/test/fitness/exercises_test.exs
@@ -21,7 +21,15 @@ defmodule Fitness.ExercisesTest do
end
test "create_exercise/1 with valid data creates a exercise" do
- valid_attrs = %{description: "some description", gif_url: "some gif_url", level: "some level", name: "some name", type: "some type", equipment: "some equipment",body_part: "some body part"}
+ valid_attrs = %{
+ description: "some description",
+ gif_url: "some gif_url",
+ level: "some level",
+ name: "some name",
+ type: "some type",
+ equipment: "some equipment",
+ body_part: "some body part"
+ }
assert {:ok, %Exercise{} = exercise} = Exercises.create_exercise(valid_attrs)
assert exercise.description == "some description"
@@ -39,7 +47,14 @@ defmodule Fitness.ExercisesTest do
test "update_exercise/2 with valid data updates the exercise" do
exercise = exercise_fixture()
- update_attrs = %{description: "some updated description", gif_url: "some updated gif_url", level: "some updated level", name: "some updated name", type: "some updated type"}
+
+ update_attrs = %{
+ description: "some updated description",
+ gif_url: "some updated gif_url",
+ level: "some updated level",
+ name: "some updated name",
+ type: "some updated type"
+ }
assert {:ok, %Exercise{} = exercise} = Exercises.update_exercise(exercise, update_attrs)
assert exercise.description == "some updated description"
diff --git a/test/fitness/workout_templates_test.exs b/test/fitness/workout_templates_test.exs
index 5cba24d..b75b21b 100644
--- a/test/fitness/workout_templates_test.exs
+++ b/test/fitness/workout_templates_test.exs
@@ -30,10 +30,10 @@ defmodule Fitness.WorkoutTemplatesTest do
user = user_fixture()
valid_attrs = %{name: "some name", user_id: user.id}
- assert {:ok, %WorkoutTemplate{} = workout_template} =
+ assert {:ok, %WorkoutTemplate{} = workout_template} =
WorkoutTemplates.create_workout_template(valid_attrs)
- assert workout_template.name == "some name"
+ assert workout_template.name == "some name"
end
test "create_workout_template/1 with invalid data returns error changeset" do
diff --git a/test/fitness_web/controllers/user_auth_test.exs b/test/fitness_web/controllers/user_auth_test.exs
index 36a5c06..1970582 100644
--- a/test/fitness_web/controllers/user_auth_test.exs
+++ b/test/fitness_web/controllers/user_auth_test.exs
@@ -132,7 +132,7 @@ defmodule FitnessWeb.UserAuthTest do
conn = conn |> fetch_flash() |> UserAuth.require_authenticated_user([])
assert conn.halted
assert redirected_to(conn) == Routes.user_session_path(conn, :new)
- assert get_flash(conn, :error) == "You must log in to access this page."
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) == "You must log in to access this page."
end
test "stores the path to redirect to on GET", %{conn: conn} do
diff --git a/test/fitness_web/controllers/user_confirmation_controller_test.exs b/test/fitness_web/controllers/user_confirmation_controller_test.exs
index ba7f9f8..3e2fc0b 100644
--- a/test/fitness_web/controllers/user_confirmation_controller_test.exs
+++ b/test/fitness_web/controllers/user_confirmation_controller_test.exs
@@ -26,7 +26,7 @@ defmodule FitnessWeb.UserConfirmationControllerTest do
})
assert redirected_to(conn) == "/"
- assert get_flash(conn, :info) =~ "If your email is in our system"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "confirm"
end
@@ -39,7 +39,7 @@ defmodule FitnessWeb.UserConfirmationControllerTest do
})
assert redirected_to(conn) == "/"
- assert get_flash(conn, :info) =~ "If your email is in our system"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
refute Repo.get_by(Accounts.UserToken, user_id: user.id)
end
@@ -50,7 +50,7 @@ defmodule FitnessWeb.UserConfirmationControllerTest do
})
assert redirected_to(conn) == "/"
- assert get_flash(conn, :info) =~ "If your email is in our system"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
assert Repo.all(Accounts.UserToken) == []
end
end
@@ -75,7 +75,7 @@ defmodule FitnessWeb.UserConfirmationControllerTest do
conn = post(conn, Routes.user_confirmation_path(conn, :update, token))
assert redirected_to(conn) == "/"
- assert get_flash(conn, :info) =~ "User confirmed successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "User confirmed successfully"
assert Accounts.get_user!(user.id).confirmed_at
refute get_session(conn, :user_token)
assert Repo.all(Accounts.UserToken) == []
@@ -83,7 +83,7 @@ defmodule FitnessWeb.UserConfirmationControllerTest do
# When not logged in
conn = post(conn, Routes.user_confirmation_path(conn, :update, token))
assert redirected_to(conn) == "/"
- assert get_flash(conn, :error) =~ "User confirmation link is invalid or it has expired"
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) =~ "User confirmation link is invalid or it has expired"
# When logged in
conn =
@@ -92,13 +92,13 @@ defmodule FitnessWeb.UserConfirmationControllerTest do
|> post(Routes.user_confirmation_path(conn, :update, token))
assert redirected_to(conn) == "/"
- refute get_flash(conn, :error)
+ refute Phoenix.Flash.get(conn.assigns.flash, :error)
end
test "does not confirm email with invalid token", %{conn: conn, user: user} do
conn = post(conn, Routes.user_confirmation_path(conn, :update, "oops"))
assert redirected_to(conn) == "/"
- assert get_flash(conn, :error) =~ "User confirmation link is invalid or it has expired"
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) =~ "User confirmation link is invalid or it has expired"
refute Accounts.get_user!(user.id).confirmed_at
end
end
diff --git a/test/fitness_web/controllers/user_reset_password_controller_test.exs b/test/fitness_web/controllers/user_reset_password_controller_test.exs
index 0d40786..00fec94 100644
--- a/test/fitness_web/controllers/user_reset_password_controller_test.exs
+++ b/test/fitness_web/controllers/user_reset_password_controller_test.exs
@@ -12,7 +12,7 @@ defmodule FitnessWeb.UserResetPasswordControllerTest do
describe "GET /users/reset_password" do
test "renders the reset password page", %{conn: conn} do
conn = get(conn, Routes.user_reset_password_path(conn, :new))
- response = html_response(conn, 200)
+ response = html_response(conn, 200)
assert response =~ "Forgot your password?"
end
end
@@ -26,7 +26,7 @@ defmodule FitnessWeb.UserResetPasswordControllerTest do
})
assert redirected_to(conn) == "/"
- assert get_flash(conn, :info) =~ "If your email is in our system"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "reset_password"
end
@@ -37,7 +37,7 @@ defmodule FitnessWeb.UserResetPasswordControllerTest do
})
assert redirected_to(conn) == "/"
- assert get_flash(conn, :info) =~ "If your email is in our system"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
assert Repo.all(Accounts.UserToken) == []
end
end
@@ -60,7 +60,7 @@ defmodule FitnessWeb.UserResetPasswordControllerTest do
test "does not render reset password with invalid token", %{conn: conn} do
conn = get(conn, Routes.user_reset_password_path(conn, :edit, "oops"))
assert redirected_to(conn) == "/"
- assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired"
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) =~ "Reset password link is invalid or it has expired"
end
end
@@ -85,7 +85,7 @@ defmodule FitnessWeb.UserResetPasswordControllerTest do
assert redirected_to(conn) == Routes.user_session_path(conn, :new)
refute get_session(conn, :user_token)
- assert get_flash(conn, :info) =~ "Password reset successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Password reset successfully"
assert Accounts.get_user_by_email_and_password(user.email, "new valid password")
end
@@ -107,7 +107,7 @@ defmodule FitnessWeb.UserResetPasswordControllerTest do
test "does not reset password with invalid token", %{conn: conn} do
conn = put(conn, Routes.user_reset_password_path(conn, :update, "oops"))
assert redirected_to(conn) == "/"
- assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired"
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) =~ "Reset password link is invalid or it has expired"
end
end
end
diff --git a/test/fitness_web/controllers/user_settings_controller_test.exs b/test/fitness_web/controllers/user_settings_controller_test.exs
index 8f28481..ea8eec3 100644
--- a/test/fitness_web/controllers/user_settings_controller_test.exs
+++ b/test/fitness_web/controllers/user_settings_controller_test.exs
@@ -34,7 +34,7 @@ defmodule FitnessWeb.UserSettingsControllerTest do
assert redirected_to(new_password_conn) == Routes.user_settings_path(conn, :edit)
assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token)
- assert get_flash(new_password_conn, :info) =~ "Password updated successfully"
+ assert Phoenix.Flash.get(new_password_conn.assigns.flash, :info) =~ "Password updated successfully"
assert Accounts.get_user_by_email_and_password(user.email, "new valid password")
end
@@ -70,7 +70,7 @@ defmodule FitnessWeb.UserSettingsControllerTest do
})
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
- assert get_flash(conn, :info) =~ "A link to confirm your email"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "A link to confirm your email"
assert Accounts.get_user_by_email(user.email)
end
@@ -104,19 +104,19 @@ defmodule FitnessWeb.UserSettingsControllerTest do
test "updates the user email once", %{conn: conn, user: user, token: token, email: email} do
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
- assert get_flash(conn, :info) =~ "Email changed successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Email changed successfully"
refute Accounts.get_user_by_email(user.email)
assert Accounts.get_user_by_email(email)
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
- assert get_flash(conn, :error) =~ "Email change link is invalid or it has expired"
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) =~ "Email change link is invalid or it has expired"
end
test "does not update email with invalid token", %{conn: conn, user: user} do
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, "oops"))
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
- assert get_flash(conn, :error) =~ "Email change link is invalid or it has expired"
+ assert Phoenix.Flash.get(conn.assigns.flash, :error) =~ "Email change link is invalid or it has expired"
assert Accounts.get_user_by_email(user.email)
end
diff --git a/test/fitness_web/live/exercise_live_test.exs b/test/fitness_web/live/exercise_live_test.exs
index f357042..6c56061 100644
--- a/test/fitness_web/live/exercise_live_test.exs
+++ b/test/fitness_web/live/exercise_live_test.exs
@@ -25,7 +25,15 @@ defmodule FitnessWeb.ExerciseLiveTest do
equipment: "Others",
body_part: "Others"
}
- @invalid_attrs %{description: nil, gif_url: nil, level: "Others", name: nil, type: "Others", equipment: "Others", body_part: "Others"}
+ @invalid_attrs %{
+ description: nil,
+ gif_url: nil,
+ level: "Others",
+ name: nil,
+ type: "Others",
+ equipment: "Others",
+ body_part: "Others"
+ }
setup %{conn: conn} do
conn =
@@ -83,7 +91,6 @@ defmodule FitnessWeb.ExerciseLiveTest do
{:ok, index_live, _html} = live(conn, Routes.exercise_index_path(conn, :index))
-
assert index_live |> element("#exercise-#{exercise.id} a", "Edit") |> render_click() =~
"Edit Exercise"
@@ -104,7 +111,6 @@ defmodule FitnessWeb.ExerciseLiveTest do
end
test "deletes exercise in listing", %{conn: conn, exercise: exercise, user: user} do
-
conn = conn |> log_in_user(user)
{:ok, index_live, _html} = live(conn, Routes.exercise_index_path(conn, :index))
@@ -127,7 +133,6 @@ defmodule FitnessWeb.ExerciseLiveTest do
{:ok, show_live, _html} = live(conn, Routes.exercise_show_path(conn, :show, exercise))
-
assert show_live |> element("a", "Edit") |> render_click() =~
"Edit Exercise"
diff --git a/test/fitness_web/live/workout_template_live_test.exs b/test/fitness_web/live/workout_template_live_test.exs
index 2da4a5a..f260ba6 100644
--- a/test/fitness_web/live/workout_template_live_test.exs
+++ b/test/fitness_web/live/workout_template_live_test.exs
@@ -18,7 +18,11 @@ defmodule FitnessWeb.WorkoutTemplateLiveTest do
describe "Index" do
setup [:create_workout_template]
- test "lists all workout_templates", %{conn: conn, workout_template: workout_template, user: user} do
+ test "lists all workout_templates", %{
+ conn: conn,
+ workout_template: workout_template,
+ user: user
+ } do
conn = conn |> log_in_user(user)
{:ok, _index_live, html} = live(conn, Routes.workout_template_index_path(conn, :index))
@@ -33,30 +37,36 @@ defmodule FitnessWeb.WorkoutTemplateLiveTest do
{:ok, index_live, _html} = live(conn, Routes.workout_template_index_path(conn, :index))
assert index_live |> element("a", "New Workout") |> render_click() =~
- "New Workout template"
+ "New Workout template"
assert_patch(index_live, Routes.workout_template_index_path(conn, :new))
assert index_live
- |> form("#workout_template-form", workout_template: @invalid_attrs)
- |> render_change() =~ "can't be blank"
+ |> form("#workout_template-form", workout_template: @invalid_attrs)
+ |> render_change() =~ "can't be blank"
{:error, {:live_redirect, %{to: location}}} =
index_live
|> form("#workout_template-form", workout_template: @create_attrs)
|> render_submit()
- {:ok, _, html} = live(conn, location)
+ {:ok, _, html} = live(conn, location)
assert html =~ "SOME NAME"
end
- test "updates workout_template in listing", %{conn: conn, workout_template: workout_template, user: user} do
+ test "updates workout_template in listing", %{
+ conn: conn,
+ workout_template: workout_template,
+ user: user
+ } do
conn = conn |> log_in_user(user)
{:ok, index_live, _html} = live(conn, Routes.workout_template_index_path(conn, :index))
- assert index_live |> element("#workout_template-#{workout_template.id} a", "Edit") |> render_click() =~
+ assert index_live
+ |> element("#workout_template-#{workout_template.id} a", "Edit")
+ |> render_click() =~
"Edit Workout template"
assert_patch(index_live, Routes.workout_template_index_path(conn, :edit, workout_template))
@@ -75,12 +85,19 @@ defmodule FitnessWeb.WorkoutTemplateLiveTest do
assert html =~ "SOME UPDATED NAME"
end
- test "deletes workout_template in listing", %{conn: conn, workout_template: workout_template, user: user} do
+ test "deletes workout_template in listing", %{
+ conn: conn,
+ workout_template: workout_template,
+ user: user
+ } do
conn = conn |> log_in_user(user)
{:ok, index_live, _html} = live(conn, Routes.workout_template_index_path(conn, :index))
- assert index_live |> element("#workout_template-#{workout_template.id} a", "Delete") |> render_click()
+ assert index_live
+ |> element("#workout_template-#{workout_template.id} a", "Delete")
+ |> render_click()
+
refute has_element?(index_live, "#workout_template-#{workout_template.id}")
end
end
@@ -88,22 +105,33 @@ defmodule FitnessWeb.WorkoutTemplateLiveTest do
describe "Show" do
setup [:create_workout_template]
- test "displays workout_template", %{conn: conn, workout_template: workout_template, user: user} do
+ test "displays workout_template", %{
+ conn: conn,
+ workout_template: workout_template,
+ user: user
+ } do
conn = conn |> log_in_user(user)
- {:ok, _show_live, html} = live(conn, Routes.workout_template_show_path(conn, :show, workout_template))
+
+ {:ok, _show_live, html} =
+ live(conn, Routes.workout_template_show_path(conn, :show, workout_template))
assert html =~ "Show Workout template"
assert html =~ String.upcase(workout_template.name)
end
- test "Add workout_items within modal", %{conn: conn, workout_template: workout_template, user: user} do
- conn = conn |> log_in_user(user)
+ test "Add workout_items within modal", %{
+ conn: conn,
+ workout_template: workout_template,
+ user: user
+ } do
+ conn = conn |> log_in_user(user)
- {:ok, show_live, _html} = live(conn, Routes.workout_template_show_path(conn, :show, workout_template))
+ {:ok, show_live, _html} =
+ live(conn, Routes.workout_template_show_path(conn, :show, workout_template))
- assert show_live |> element("a", "ADD EXERCISE") |> render_click() =~ "Add New Exercises"
+ assert show_live |> element("a", "ADD EXERCISE") |> render_click() =~ "Add New Exercises"
- assert_patch(show_live, Routes.workout_template_show_path(conn, :edit, workout_template))
+ assert_patch(show_live, Routes.workout_template_show_path(conn, :edit, workout_template))
# assert show_live
# |> form("#workout_items_form", workout_items: @invalid_attrs_workout_items)
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex
index 4843dcc..44caeee 100644
--- a/test/support/conn_case.ex
+++ b/test/support/conn_case.ex
@@ -28,6 +28,8 @@ defmodule FitnessWeb.ConnCase do
# The default endpoint for testing
@endpoint FitnessWeb.Endpoint
+
+ use FitnessWeb, :verified_routes
end
end