forked from shibao/cannery
		
	rename ammo groups to packs everywhere
This commit is contained in:
		@@ -34,7 +34,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
    grains: nil
 | 
			
		||||
  }
 | 
			
		||||
  @pack_attrs %{
 | 
			
		||||
    notes: "some ammo group",
 | 
			
		||||
    notes: "some pack",
 | 
			
		||||
    count: 20
 | 
			
		||||
  }
 | 
			
		||||
  @shot_group_attrs %{
 | 
			
		||||
@@ -248,10 +248,10 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Index with ammo group" do
 | 
			
		||||
  describe "Index with pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_ammo_type, :create_pack]
 | 
			
		||||
 | 
			
		||||
    test "shows used ammo groups on toggle",
 | 
			
		||||
    test "shows used packs on toggle",
 | 
			
		||||
         %{conn: conn, pack: pack, current_user: current_user} do
 | 
			
		||||
      {:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index))
 | 
			
		||||
 | 
			
		||||
@@ -327,10 +327,10 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Show ammo type with ammo group" do
 | 
			
		||||
  describe "Show ammo type with pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_ammo_type, :create_pack]
 | 
			
		||||
 | 
			
		||||
    test "displays ammo group", %{
 | 
			
		||||
    test "displays pack", %{
 | 
			
		||||
      conn: conn,
 | 
			
		||||
      ammo_type: %{name: ammo_type_name} = ammo_type,
 | 
			
		||||
      container: %{name: container_name}
 | 
			
		||||
@@ -342,7 +342,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
      assert html =~ container_name
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    test "displays ammo group in table",
 | 
			
		||||
    test "displays pack in table",
 | 
			
		||||
         %{conn: conn, ammo_type: ammo_type, container: %{name: container_name}} do
 | 
			
		||||
      {:ok, show_live, _html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type))
 | 
			
		||||
 | 
			
		||||
@@ -356,10 +356,10 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Show ammo type with empty ammo group" do
 | 
			
		||||
  describe "Show ammo type with empty pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_ammo_type, :create_empty_pack]
 | 
			
		||||
 | 
			
		||||
    test "displays empty ammo groups on toggle",
 | 
			
		||||
    test "displays empty packs on toggle",
 | 
			
		||||
         %{conn: conn, ammo_type: ammo_type, container: %{name: container_name}} do
 | 
			
		||||
      {:ok, show_live, html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type))
 | 
			
		||||
      assert html =~ "Show used"
 | 
			
		||||
@@ -375,7 +375,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
      assert html =~ container_name
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    test "displays empty ammo groups in table on toggle",
 | 
			
		||||
    test "displays empty packs in table on toggle",
 | 
			
		||||
         %{conn: conn, ammo_type: ammo_type, container: %{name: container_name}} do
 | 
			
		||||
      {:ok, show_live, _html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
    grains: 120
 | 
			
		||||
  }
 | 
			
		||||
  @pack_attrs %{
 | 
			
		||||
    notes: "some ammo group",
 | 
			
		||||
    notes: "some pack",
 | 
			
		||||
    count: 20
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -298,10 +298,10 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Show with ammo group" do
 | 
			
		||||
  describe "Show with pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_container, :create_pack]
 | 
			
		||||
 | 
			
		||||
    test "displays ammo group",
 | 
			
		||||
    test "displays pack",
 | 
			
		||||
         %{conn: conn, ammo_type: %{name: ammo_type_name}, container: container} do
 | 
			
		||||
      {:ok, _show_live, html} = live(conn, Routes.container_show_path(conn, :show, container))
 | 
			
		||||
 | 
			
		||||
@@ -309,7 +309,7 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
      assert html =~ "\n20\n"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    test "displays ammo group in table",
 | 
			
		||||
    test "displays pack in table",
 | 
			
		||||
         %{conn: conn, ammo_type: %{name: ammo_type_name}, container: container} do
 | 
			
		||||
      {:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
  @moduledoc """
 | 
			
		||||
  Tests ammo group live pages
 | 
			
		||||
  Tests pack live pages
 | 
			
		||||
  """
 | 
			
		||||
 | 
			
		||||
  use CanneryWeb.ConnCase
 | 
			
		||||
@@ -52,7 +52,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
    [empty_pack: pack, shot_group: shot_group]
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Index of ammo group" do
 | 
			
		||||
  describe "Index of pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_pack]
 | 
			
		||||
 | 
			
		||||
    test "lists all packs", %{conn: conn, pack: pack} do
 | 
			
		||||
@@ -213,7 +213,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
      {:ok, index_live, _html} = live(conn, Routes.pack_index_path(conn, :index))
 | 
			
		||||
 | 
			
		||||
      assert index_live
 | 
			
		||||
             |> element(~s/a[aria-label="Edit ammo group of #{pack.count} bullets"]/)
 | 
			
		||||
             |> element(~s/a[aria-label="Edit pack of #{pack.count} bullets"]/)
 | 
			
		||||
             |> render_click() =~ "Edit ammo"
 | 
			
		||||
 | 
			
		||||
      assert_patch(index_live, Routes.pack_index_path(conn, :edit, pack))
 | 
			
		||||
@@ -237,7 +237,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> element(~s/a[aria-label="Clone ammo group of #{pack.count} bullets"]/)
 | 
			
		||||
        |> element(~s/a[aria-label="Clone pack of #{pack.count} bullets"]/)
 | 
			
		||||
        |> render_click()
 | 
			
		||||
 | 
			
		||||
      assert html =~ "Add Ammo"
 | 
			
		||||
@@ -261,7 +261,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> element(~s/a[aria-label="Clone ammo group of #{pack.count} bullets"]/)
 | 
			
		||||
        |> element(~s/a[aria-label="Clone pack of #{pack.count} bullets"]/)
 | 
			
		||||
        |> render_click()
 | 
			
		||||
 | 
			
		||||
      assert html =~ "Add Ammo"
 | 
			
		||||
@@ -279,7 +279,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> element(~s/a[aria-label="Clone ammo group of #{pack.count} bullets"]/)
 | 
			
		||||
        |> element(~s/a[aria-label="Clone pack of #{pack.count} bullets"]/)
 | 
			
		||||
        |> render_click()
 | 
			
		||||
 | 
			
		||||
      assert html =~ "Add Ammo"
 | 
			
		||||
@@ -305,7 +305,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
      {:ok, index_live, _html} = live(conn, Routes.pack_index_path(conn, :index))
 | 
			
		||||
 | 
			
		||||
      assert index_live
 | 
			
		||||
             |> element(~s/a[aria-label="Delete ammo group of #{pack.count} bullets"]/)
 | 
			
		||||
             |> element(~s/a[aria-label="Delete pack of #{pack.count} bullets"]/)
 | 
			
		||||
             |> render_click()
 | 
			
		||||
 | 
			
		||||
      refute has_element?(index_live, "#pack-#{pack.id}")
 | 
			
		||||
@@ -334,10 +334,10 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
    defp display_currency(float), do: :erlang.float_to_binary(float, decimals: 2)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Index of empty ammo group" do
 | 
			
		||||
  describe "Index of empty pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_pack, :create_empty_pack]
 | 
			
		||||
 | 
			
		||||
    test "hides empty ammo groups by default", %{
 | 
			
		||||
    test "hides empty packs by default", %{
 | 
			
		||||
      conn: conn,
 | 
			
		||||
      empty_pack: pack,
 | 
			
		||||
      current_user: current_user
 | 
			
		||||
@@ -361,7 +361,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Show ammo group" do
 | 
			
		||||
  describe "Show pack" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_pack]
 | 
			
		||||
 | 
			
		||||
    test "displays pack", %{conn: conn, pack: pack} do
 | 
			
		||||
@@ -375,7 +375,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
      {:ok, show_live, _html} = live(conn, Routes.pack_show_path(conn, :show, pack))
 | 
			
		||||
 | 
			
		||||
      assert show_live
 | 
			
		||||
             |> element(~s/a[aria-label="Edit ammo group of #{pack.count} bullets"]/)
 | 
			
		||||
             |> element(~s/a[aria-label="Edit pack of #{pack.count} bullets"]/)
 | 
			
		||||
             |> render_click() =~ "Edit Ammo"
 | 
			
		||||
 | 
			
		||||
      assert_patch(show_live, Routes.pack_show_path(conn, :edit, pack))
 | 
			
		||||
@@ -414,7 +414,7 @@ defmodule CanneryWeb.PackLiveTest do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "Show ammo group with shot group" do
 | 
			
		||||
  describe "Show pack with shot group" do
 | 
			
		||||
    setup [:register_and_log_in_user, :create_pack, :create_shot_group]
 | 
			
		||||
 | 
			
		||||
    test "updates shot_group in listing",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user