forked from shibao/cannery
		
	rename ammo_type type to class
This commit is contained in:
		@@ -64,11 +64,11 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
 | 
			
		||||
 | 
			
		||||
    test "can sort by type",
 | 
			
		||||
         %{conn: conn, container: container, current_user: current_user} do
 | 
			
		||||
      rifle_type = ammo_type_fixture(%{type: "rifle"}, current_user)
 | 
			
		||||
      rifle_type = ammo_type_fixture(%{class: :rifle}, current_user)
 | 
			
		||||
      {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_type, container, current_user)
 | 
			
		||||
      shotgun_type = ammo_type_fixture(%{type: "shotgun"}, current_user)
 | 
			
		||||
      shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user)
 | 
			
		||||
      {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_type, container, current_user)
 | 
			
		||||
      pistol_type = ammo_type_fixture(%{type: "pistol"}, current_user)
 | 
			
		||||
      pistol_type = ammo_type_fixture(%{class: :pistol}, current_user)
 | 
			
		||||
      {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_type, container, current_user)
 | 
			
		||||
 | 
			
		||||
      {:ok, index_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index))
 | 
			
		||||
@@ -81,8 +81,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :rifle})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :rifle})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      refute html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
@@ -90,8 +90,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :shotgun})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :shotgun})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      assert html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
@@ -99,8 +99,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :pistol})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :pistol})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      refute html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
@@ -108,8 +108,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :all})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :all})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      assert html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
 
 | 
			
		||||
@@ -69,10 +69,10 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
      assert html =~ ammo_type.bullet_type
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    test "can sort by type", %{conn: conn, current_user: current_user} do
 | 
			
		||||
      rifle_type = ammo_type_fixture(%{type: "rifle"}, current_user)
 | 
			
		||||
      shotgun_type = ammo_type_fixture(%{type: "shotgun"}, current_user)
 | 
			
		||||
      pistol_type = ammo_type_fixture(%{type: "pistol"}, current_user)
 | 
			
		||||
    test "can sort by class", %{conn: conn, current_user: current_user} do
 | 
			
		||||
      rifle_type = ammo_type_fixture(%{class: :rifle}, current_user)
 | 
			
		||||
      shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user)
 | 
			
		||||
      pistol_type = ammo_type_fixture(%{class: :pistol}, current_user)
 | 
			
		||||
 | 
			
		||||
      {:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index))
 | 
			
		||||
 | 
			
		||||
@@ -84,8 +84,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :rifle})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :rifle})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_type.name
 | 
			
		||||
      refute html =~ shotgun_type.name
 | 
			
		||||
@@ -93,8 +93,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :shotgun})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :shotgun})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_type.name
 | 
			
		||||
      assert html =~ shotgun_type.name
 | 
			
		||||
@@ -102,8 +102,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :pistol})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :pistol})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_type.name
 | 
			
		||||
      refute html =~ shotgun_type.name
 | 
			
		||||
@@ -111,8 +111,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :all})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :all})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_type.name
 | 
			
		||||
      assert html =~ shotgun_type.name
 | 
			
		||||
 
 | 
			
		||||
@@ -245,11 +245,11 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
 | 
			
		||||
    test "can sort by type",
 | 
			
		||||
         %{conn: conn, container: container, current_user: current_user} do
 | 
			
		||||
      rifle_type = ammo_type_fixture(%{type: "rifle"}, current_user)
 | 
			
		||||
      rifle_type = ammo_type_fixture(%{class: :rifle}, current_user)
 | 
			
		||||
      {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_type, container, current_user)
 | 
			
		||||
      shotgun_type = ammo_type_fixture(%{type: "shotgun"}, current_user)
 | 
			
		||||
      shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user)
 | 
			
		||||
      {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_type, container, current_user)
 | 
			
		||||
      pistol_type = ammo_type_fixture(%{type: "pistol"}, current_user)
 | 
			
		||||
      pistol_type = ammo_type_fixture(%{class: :pistol}, current_user)
 | 
			
		||||
      {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_type, container, current_user)
 | 
			
		||||
 | 
			
		||||
      {:ok, index_live, html} = live(conn, Routes.container_show_path(conn, :show, container))
 | 
			
		||||
@@ -262,8 +262,8 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :rifle})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :rifle})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      refute html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
@@ -271,8 +271,8 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :shotgun})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :shotgun})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      assert html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
@@ -280,8 +280,8 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :pistol})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :pistol})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      refute html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
@@ -289,8 +289,8 @@ defmodule CanneryWeb.ContainerLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :all})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :all})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_ammo_group.ammo_type.name
 | 
			
		||||
      assert html =~ shotgun_ammo_group.ammo_type.name
 | 
			
		||||
 
 | 
			
		||||
@@ -42,18 +42,18 @@ defmodule CanneryWeb.RangeLiveTest do
 | 
			
		||||
 | 
			
		||||
    test "can sort by type",
 | 
			
		||||
         %{conn: conn, container: container, current_user: current_user} do
 | 
			
		||||
      rifle_ammo_type = ammo_type_fixture(%{type: "rifle"}, current_user)
 | 
			
		||||
      rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user)
 | 
			
		||||
      {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user)
 | 
			
		||||
 | 
			
		||||
      rifle_shot_group = shot_group_fixture(%{notes: "group_one"}, current_user, rifle_ammo_group)
 | 
			
		||||
 | 
			
		||||
      shotgun_ammo_type = ammo_type_fixture(%{type: "shotgun"}, current_user)
 | 
			
		||||
      shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user)
 | 
			
		||||
      {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user)
 | 
			
		||||
 | 
			
		||||
      shotgun_shot_group =
 | 
			
		||||
        shot_group_fixture(%{notes: "group_two"}, current_user, shotgun_ammo_group)
 | 
			
		||||
 | 
			
		||||
      pistol_ammo_type = ammo_type_fixture(%{type: "pistol"}, current_user)
 | 
			
		||||
      pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user)
 | 
			
		||||
      {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user)
 | 
			
		||||
 | 
			
		||||
      pistol_shot_group =
 | 
			
		||||
@@ -69,8 +69,8 @@ defmodule CanneryWeb.RangeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :rifle})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :rifle})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_shot_group.notes
 | 
			
		||||
      refute html =~ shotgun_shot_group.notes
 | 
			
		||||
@@ -78,8 +78,8 @@ defmodule CanneryWeb.RangeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :shotgun})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :shotgun})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_shot_group.notes
 | 
			
		||||
      assert html =~ shotgun_shot_group.notes
 | 
			
		||||
@@ -87,8 +87,8 @@ defmodule CanneryWeb.RangeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :pistol})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :pistol})
 | 
			
		||||
 | 
			
		||||
      refute html =~ rifle_shot_group.notes
 | 
			
		||||
      refute html =~ shotgun_shot_group.notes
 | 
			
		||||
@@ -96,8 +96,8 @@ defmodule CanneryWeb.RangeLiveTest do
 | 
			
		||||
 | 
			
		||||
      html =
 | 
			
		||||
        index_live
 | 
			
		||||
        |> form(~s/form[phx-change="change_type"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{type: :all})
 | 
			
		||||
        |> form(~s/form[phx-change="change_class"]/)
 | 
			
		||||
        |> render_change(ammo_type: %{class: :all})
 | 
			
		||||
 | 
			
		||||
      assert html =~ rifle_shot_group.notes
 | 
			
		||||
      assert html =~ shotgun_shot_group.notes
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user