forked from shibao/cannery
mix format
This commit is contained in:
parent
8f807c2ebc
commit
08f87d38eb
@ -35,6 +35,8 @@ defmodule Cannery.Mailer do
|
|||||||
"""
|
"""
|
||||||
@spec deliver_update_email_instructions(User.t(), String.t()) :: Job.t()
|
@spec deliver_update_email_instructions(User.t(), String.t()) :: Job.t()
|
||||||
def deliver_update_email_instructions(%User{id: user_id}, url) do
|
def deliver_update_email_instructions(%User{id: user_id}, url) do
|
||||||
%{email: :update_email, user_id: user_id, attrs: %{url: url}} |> EmailWorker.new() |> Oban.insert!()
|
%{email: :update_email, user_id: user_id, attrs: %{url: url}}
|
||||||
|
|> EmailWorker.new()
|
||||||
|
|> Oban.insert!()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -50,12 +50,12 @@
|
|||||||
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
|
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
|
||||||
<%= live_redirect to: Routes.ammo_type_show_path(@socket, :show, ammo_type),
|
<%= live_redirect to: Routes.ammo_type_show_path(@socket, :show, ammo_type),
|
||||||
class: "text-primary-500 link" do %>
|
class: "text-primary-500 link" do %>
|
||||||
<i class="fa-lg fas fa-eye"></i>
|
<i class="fa-fw fa-lg fas fa-eye"></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= live_patch to: Routes.ammo_type_index_path(@socket, :edit, ammo_type),
|
<%= live_patch to: Routes.ammo_type_index_path(@socket, :edit, ammo_type),
|
||||||
class: "text-primary-500 link" do %>
|
class: "text-primary-500 link" do %>
|
||||||
<i class="fa-lg fas fa-edit"></i>
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link to: "#",
|
<%= link to: "#",
|
||||||
|
@ -9,8 +9,7 @@ defmodule Cannery.ActivityLogTest do
|
|||||||
alias Cannery.{
|
alias Cannery.{
|
||||||
ActivityLog,
|
ActivityLog,
|
||||||
ActivityLog.ShotGroup,
|
ActivityLog.ShotGroup,
|
||||||
Ammo,
|
Ammo
|
||||||
Containers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@moduletag :activity_log_test
|
@moduletag :activity_log_test
|
||||||
@ -87,13 +86,10 @@ defmodule Cannery.ActivityLogTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "create_shot_group/1 does not remove more than ammo group amount",
|
test "create_shot_group/1 does not remove more than ammo group amount",
|
||||||
%{
|
%{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do
|
||||||
current_user: current_user,
|
|
||||||
ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group
|
|
||||||
} do
|
|
||||||
valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"}
|
valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"}
|
||||||
|
|
||||||
assert {:ok, %ShotGroup{} = shot_group} =
|
assert {:ok, %ShotGroup{}} =
|
||||||
ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group)
|
ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group)
|
||||||
|
|
||||||
ammo_group = ammo_group_id |> Ammo.get_ammo_group!(current_user)
|
ammo_group = ammo_group_id |> Ammo.get_ammo_group!(current_user)
|
||||||
@ -115,7 +111,7 @@ defmodule Cannery.ActivityLogTest do
|
|||||||
test "update_shot_group/2 with valid data updates the shot_group and ammo_group",
|
test "update_shot_group/2 with valid data updates the shot_group and ammo_group",
|
||||||
%{
|
%{
|
||||||
shot_group: shot_group,
|
shot_group: shot_group,
|
||||||
ammo_group: %{id: ammo_group_id} = ammo_group,
|
ammo_group: %{id: ammo_group_id},
|
||||||
current_user: current_user
|
current_user: current_user
|
||||||
} do
|
} do
|
||||||
assert {:ok, %ShotGroup{} = shot_group} =
|
assert {:ok, %ShotGroup{} = shot_group} =
|
||||||
|
@ -5,7 +5,7 @@ defmodule Cannery.ContainersTest do
|
|||||||
|
|
||||||
use Cannery.DataCase
|
use Cannery.DataCase
|
||||||
alias Cannery.Containers
|
alias Cannery.Containers
|
||||||
alias Cannery.{Accounts.User, Containers.Container}
|
alias Cannery.{Containers.Container}
|
||||||
alias Ecto.Changeset
|
alias Ecto.Changeset
|
||||||
|
|
||||||
@moduletag :containers_test
|
@moduletag :containers_test
|
||||||
@ -41,8 +41,7 @@ defmodule Cannery.ContainersTest do
|
|||||||
assert Containers.get_container!(container.id, current_user) == container
|
assert Containers.get_container!(container.id, current_user) == container
|
||||||
end
|
end
|
||||||
|
|
||||||
test "create_container/1 with valid data creates a container",
|
test "create_container/1 with valid data creates a container", %{current_user: current_user} do
|
||||||
%{current_user: current_user, container: container} do
|
|
||||||
assert {:ok, %Container{} = container} =
|
assert {:ok, %Container{} = container} =
|
||||||
@valid_attrs |> Containers.create_container(current_user)
|
@valid_attrs |> Containers.create_container(current_user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user