From a1554879cc55c75b244a2af02502b3a337c9ad65 Mon Sep 17 00:00:00 2001 From: shibao Date: Thu, 17 Feb 2022 20:01:14 -0500 Subject: [PATCH] fixes test warnings --- lib/cannery_web/controllers/user_auth.ex | 2 +- test/cannery_web/live/ammo_group_live_test.exs | 2 +- test/cannery_web/live/invite_live_test.exs | 2 +- test/cannery_web/live/range_live_test.exs | 4 ++-- test/cannery_web/live/tag_live_test.exs | 16 +++++++++------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/cannery_web/controllers/user_auth.ex b/lib/cannery_web/controllers/user_auth.ex index 6a664f5..f277d81 100644 --- a/lib/cannery_web/controllers/user_auth.ex +++ b/lib/cannery_web/controllers/user_auth.ex @@ -31,7 +31,7 @@ defmodule CanneryWeb.UserAuth do """ def log_in_user(conn, user, params \\ %{}) - def log_in_user(conn, %User{confirmed_at: nil}, params) do + def log_in_user(conn, %User{confirmed_at: nil}, _params) do conn |> put_flash( :error, diff --git a/test/cannery_web/live/ammo_group_live_test.exs b/test/cannery_web/live/ammo_group_live_test.exs index c2270c4..aa5fdca 100644 --- a/test/cannery_web/live/ammo_group_live_test.exs +++ b/test/cannery_web/live/ammo_group_live_test.exs @@ -11,7 +11,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do @moduletag :ammo_group_live_test @create_attrs %{count: 42, notes: "some notes", price_paid: 120.5} @update_attrs %{count: 43, notes: "some updated notes", price_paid: 456.7} - @invalid_attrs %{count: -1, notes: nil, price_paid: nil} + # @invalid_attrs %{count: -1, notes: nil, price_paid: nil} defp create_ammo_group(%{current_user: current_user}) do ammo_type = ammo_type_fixture(current_user) diff --git a/test/cannery_web/live/invite_live_test.exs b/test/cannery_web/live/invite_live_test.exs index 4878966..26bcda4 100644 --- a/test/cannery_web/live/invite_live_test.exs +++ b/test/cannery_web/live/invite_live_test.exs @@ -11,7 +11,7 @@ defmodule CanneryWeb.InviteLiveTest do @moduletag :invite_live_test @create_attrs %{"name" => "some name"} @update_attrs %{"name" => "some updated name"} - @invalid_attrs %{"name" => nil} + # @invalid_attrs %{"name" => nil} describe "Index" do setup [:register_and_log_in_user] diff --git a/test/cannery_web/live/range_live_test.exs b/test/cannery_web/live/range_live_test.exs index f9e5d4a..4c05585 100644 --- a/test/cannery_web/live/range_live_test.exs +++ b/test/cannery_web/live/range_live_test.exs @@ -11,7 +11,7 @@ defmodule CanneryWeb.RangeLiveTest do @moduletag :range_live_test @create_attrs %{"ammo_left" => 5, "notes" => "some notes"} @update_attrs %{"count" => 16, "notes" => "some updated notes"} - @invalid_attrs %{"count" => nil, "notes" => nil} + # @invalid_attrs %{"count" => nil, "notes" => nil} defp create_shot_group(%{current_user: current_user}) do container = container_fixture(%{"staged" => true}, current_user) @@ -39,7 +39,7 @@ defmodule CanneryWeb.RangeLiveTest do {:ok, index_live, _html} = live(conn, Routes.range_index_path(conn, :index)) assert index_live |> element("a", dgettext("actions", "Record shots")) |> render_click() =~ - gettext("Record shots") + gettext("Record shots") assert_patch(index_live, Routes.range_index_path(conn, :add_shot_group, ammo_group)) diff --git a/test/cannery_web/live/tag_live_test.exs b/test/cannery_web/live/tag_live_test.exs index 886f3f6..c10fcff 100644 --- a/test/cannery_web/live/tag_live_test.exs +++ b/test/cannery_web/live/tag_live_test.exs @@ -19,13 +19,13 @@ defmodule CanneryWeb.TagLiveTest do "name" => "some updated name", "text_color" => "some updated text-color" } - @invalid_attrs %{ - "bg_color" => nil, - "name" => nil, - "text_color" => nil - } + # @invalid_attrs %{ + # "bg_color" => nil, + # "name" => nil, + # "text_color" => nil + # } - def create_tag %{current_user: current_user} do + def create_tag(%{current_user: current_user}) do tag = tag_fixture(current_user) %{tag: tag, current_user: current_user} end @@ -80,7 +80,9 @@ defmodule CanneryWeb.TagLiveTest do |> render_submit() |> follow_redirect(conn, Routes.tag_index_path(conn, :index)) - assert html =~ dgettext("prompts", "%{name} updated successfully", name: "some updated name") + assert html =~ + dgettext("prompts", "%{name} updated successfully", name: "some updated name") + assert html =~ "some updated bg-color" end