rename ammo groups to packs everywhere

This commit is contained in:
2023-03-29 23:49:45 -04:00
parent 0544b58ab6
commit 4b6d0952f8
35 changed files with 160 additions and 168 deletions

View File

@ -59,7 +59,7 @@ defmodule Cannery.ActivityLogTest do
assert shot_group.notes == "some notes"
end
test "create_shot_group/3 removes corresponding count from ammo group",
test "create_shot_group/3 removes corresponding count from pack",
%{
current_user: current_user,
pack: %{id: pack_id, count: org_count} = pack
@ -75,7 +75,7 @@ defmodule Cannery.ActivityLogTest do
assert new_count == 10
end
test "create_shot_group/3 does not remove more than ammo group amount",
test "create_shot_group/3 does not remove more tha pack amount",
%{current_user: current_user, pack: %{id: pack_id} = pack} do
valid_attrs = %{count: 20, date: ~D[2022-02-13], notes: "some notes"}
@ -302,7 +302,7 @@ defmodule Cannery.ActivityLogTest do
[ammo_type, another_ammo_type]
|> ActivityLog.get_used_count_for_ammo_types(current_user)
# use generated ammo group
# use generated pack
shot_group_fixture(%{count: 5}, current_user, pack)
used_counts =
@ -311,7 +311,7 @@ defmodule Cannery.ActivityLogTest do
assert %{^ammo_type_id => 5} = used_counts
assert %{^another_ammo_type_id => 5} = used_counts
# use generated ammo group again
# use generated pack again
shot_group_fixture(%{count: 1}, current_user, pack)
used_counts =
@ -407,7 +407,7 @@ defmodule Cannery.ActivityLogTest do
# notes
assert ActivityLog.list_shot_groups("amazing", :all, current_user) == [shot_group_a]
# ammo group attributes
# pack attributes
assert ActivityLog.list_shot_groups("stupendous", :all, current_user) == [shot_group_b]
# ammo type attributes

View File

@ -4,7 +4,7 @@ defmodule Cannery.AmmoTest do
"""
use Cannery.DataCase
alias Cannery.{Ammo, Ammo.Pack, Ammo.AmmoType, Containers}
alias Cannery.{Ammo, Ammo.AmmoType, Ammo.Pack, Containers}
alias Ecto.Changeset
@moduletag :ammo_test
@ -211,7 +211,7 @@ defmodule Cannery.AmmoTest do
end
end
describe "ammo types with ammo groups" do
describe "ammo types with packs" do
setup do
current_user = user_fixture()
ammo_type = ammo_type_fixture(current_user)
@ -516,14 +516,14 @@ defmodule Cannery.AmmoTest do
[ammo_type, another_ammo_type]
|> Ammo.get_used_packs_count_for_types(current_user)
# testing ammo type with ammo group
# testing ammo type with pack
{1, [first_pack]} = pack_fixture(%{count: 1}, ammo_type, container, current_user)
assert %{} ==
[ammo_type, another_ammo_type]
|> Ammo.get_used_packs_count_for_types(current_user)
# testing ammo type with used ammo group
# testing ammo type with used pack
{1, [another_pack]} = pack_fixture(%{count: 50}, another_ammo_type, container, current_user)
shot_group_fixture(%{count: 50}, current_user, another_pack)
@ -532,7 +532,7 @@ defmodule Cannery.AmmoTest do
[ammo_type, another_ammo_type]
|> Ammo.get_used_packs_count_for_types(current_user)
# testing two ammo types with zero and one used ammo groups
# testing two ammo types with zero and one used packs
{1, [pack]} = pack_fixture(%{count: 50}, ammo_type, container, current_user)
shot_group_fixture(%{count: 50}, current_user, pack)
@ -542,7 +542,7 @@ defmodule Cannery.AmmoTest do
assert %{^ammo_type_id => 1} = used_counts
assert %{^another_ammo_type_id => 1} = used_counts
# testing two ammo type with one and two used ammo groups
# testing two ammo type with one and two used packs
shot_group_fixture(%{count: 1}, current_user, first_pack)
used_counts =
@ -778,14 +778,14 @@ defmodule Cannery.AmmoTest do
assert pack in packs
end
test "list_packs/4 returns relevant ammo groups when searched", %{
test "list_packs/4 returns relevant packs when searched", %{
ammo_type: ammo_type,
pack: pack,
container: container,
current_user: current_user
} do
{1, [another_pack]} =
%{count: 49, notes: "cool ammo group"}
%{count: 49, notes: "cool pack"}
|> pack_fixture(ammo_type, container, current_user)
another_ammo_type = ammo_type_fixture(%{name: "amazing ammo"}, current_user)
@ -806,7 +806,7 @@ defmodule Cannery.AmmoTest do
assert another_pack in packs
assert pack in packs
# search works for ammo group attributes
# search works for pack attributes
assert Ammo.list_packs("cool", :all, current_user, true) == [another_pack]
# search works for ammo type attributes