fix tests
This commit is contained in:
		| @@ -5,7 +5,7 @@ defmodule Lokal.Accounts do | |||||||
|  |  | ||||||
|   import Ecto.Query, warn: false |   import Ecto.Query, warn: false | ||||||
|   alias Lokal.Repo |   alias Lokal.Repo | ||||||
|   alias Lokal.Accounts.{User, UserToken, UserNotifier} |   alias Lokal.Accounts.{User, UserNotifier, UserToken} | ||||||
|  |  | ||||||
|   ## Database getters |   ## Database getters | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule Lokal.Accounts.User do | defmodule Lokal.Accounts.User do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Schema for a registered user | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use Ecto.Schema |   use Ecto.Schema | ||||||
|   import Ecto.Changeset |   import Ecto.Changeset | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule Lokal.Accounts.UserNotifier do | defmodule Lokal.Accounts.UserNotifier do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Contains templates and messages for user messages | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   # For simplicity, this module simply logs messages to the terminal. |   # For simplicity, this module simply logs messages to the terminal. | ||||||
|   # You should replace it by a proper email or notification tool, such as: |   # You should replace it by a proper email or notification tool, such as: | ||||||
|   # |   # | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule Lokal.Accounts.UserToken do | defmodule Lokal.Accounts.UserToken do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Schema for a user's session token | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use Ecto.Schema |   use Ecto.Schema | ||||||
|   import Ecto.Query |   import Ecto.Query | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
| defmodule Lokal.Mailer do | defmodule Lokal.Mailer do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Mailer, currently uses Swoosh | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use Swoosh.Mailer, otp_app: :lokal |   use Swoosh.Mailer, otp_app: :lokal | ||||||
| end | end | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule Lokal.Release do | defmodule Lokal.Release do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Contains mix tasks that can used in generated releases | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   @app :lokal |   @app :lokal | ||||||
|  |  | ||||||
|   def rollback(repo, version) do |   def rollback(repo, version) do | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule Lokal.Repo.Migrator do | defmodule Lokal.Repo.Migrator do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Genserver to automatically perform all migration on app start | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use GenServer |   use GenServer | ||||||
|   require Logger |   require Logger | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ defmodule LokalWeb.Component.Topbar do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use LokalWeb, :component |   use LokalWeb, :component | ||||||
|   alias LokalWeb.{PageLive} |   alias LokalWeb.PageLive | ||||||
|  |  | ||||||
|   def topbar(assigns) do |   def topbar(assigns) do | ||||||
|     assigns = |     assigns = | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule LokalWeb.UserAuth do | defmodule LokalWeb.UserAuth do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Module for any user authentication functions | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   import Plug.Conn |   import Plug.Conn | ||||||
|   import Phoenix.Controller |   import Phoenix.Controller | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,11 @@ | |||||||
| defmodule LokalWeb.LiveHelpers do | defmodule LokalWeb.LiveHelpers do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Contains resuable methods for all liveviews | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   import Phoenix.LiveView.Helpers |   import Phoenix.LiveView.Helpers | ||||||
|   import Phoenix.LiveView, only: [assign_new: 3] |   import Phoenix.LiveView, only: [assign_new: 3] | ||||||
|   alias Lokal.{Accounts} |   alias Lokal.Accounts | ||||||
|  |  | ||||||
|   @doc """ |   @doc """ | ||||||
|   Renders a component inside the `LokalWeb.ModalComponent` component. |   Renders a component inside the `LokalWeb.ModalComponent` component. | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule LokalWeb.ModalComponent do | defmodule LokalWeb.ModalComponent do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Component that provides a floating modal | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use LokalWeb, :live_component |   use LokalWeb, :live_component | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule LokalWeb.PageLive do | defmodule LokalWeb.PageLive do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Liveview for the main home page | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use LokalWeb, :live_view |   use LokalWeb, :live_view | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   | |||||||
| @@ -1,4 +1,8 @@ | |||||||
| defmodule LokalWeb.Telemetry do | defmodule LokalWeb.Telemetry do | ||||||
|  |   @moduledoc """ | ||||||
|  |   Telemetry genserver | ||||||
|  |   """ | ||||||
|  |  | ||||||
|   use Supervisor |   use Supervisor | ||||||
|   import Telemetry.Metrics |   import Telemetry.Metrics | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| defmodule LokalWeb.LayoutView do | defmodule LokalWeb.LayoutView do | ||||||
|   use LokalWeb, :view |   use LokalWeb, :view | ||||||
|   alias LokalWeb.{PageLive} |   alias LokalWeb.PageLive | ||||||
|  |  | ||||||
|   # Phoenix LiveDashboard is available only in development by default, |   # Phoenix LiveDashboard is available only in development by default, | ||||||
|   # so we instruct Elixir to not warn if the dashboard route is missing. |   # so we instruct Elixir to not warn if the dashboard route is missing. | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ defmodule LokalWeb.ChannelCase do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use ExUnit.CaseTemplate |   use ExUnit.CaseTemplate | ||||||
|  |   alias Ecto.Adapters.SQL.Sandbox | ||||||
|  |  | ||||||
|   using do |   using do | ||||||
|     quote do |     quote do | ||||||
| @@ -29,8 +30,8 @@ defmodule LokalWeb.ChannelCase do | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   setup tags do |   setup tags do | ||||||
|     pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async]) |     pid = Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async]) | ||||||
|     on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) |     on_exit(fn -> Sandbox.stop_owner(pid) end) | ||||||
|     :ok |     :ok | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ defmodule LokalWeb.ConnCase do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use ExUnit.CaseTemplate |   use ExUnit.CaseTemplate | ||||||
|  |   alias Ecto.Adapters.SQL.Sandbox | ||||||
|  |  | ||||||
|   using do |   using do | ||||||
|     quote do |     quote do | ||||||
| @@ -32,8 +33,8 @@ defmodule LokalWeb.ConnCase do | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   setup tags do |   setup tags do | ||||||
|     pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async]) |     pid = Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async]) | ||||||
|     on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) |     on_exit(fn -> Sandbox.stop_owner(pid) end) | ||||||
|     {:ok, conn: Phoenix.ConnTest.build_conn()} |     {:ok, conn: Phoenix.ConnTest.build_conn()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ defmodule Lokal.DataCase do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use ExUnit.CaseTemplate |   use ExUnit.CaseTemplate | ||||||
|  |   alias Ecto.Adapters.SQL.Sandbox | ||||||
|  |  | ||||||
|   using do |   using do | ||||||
|     quote do |     quote do | ||||||
| @@ -28,8 +29,8 @@ defmodule Lokal.DataCase do | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   setup tags do |   setup tags do | ||||||
|     pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async]) |     pid = Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async]) | ||||||
|     on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) |     on_exit(fn -> Sandbox.stop_owner(pid) end) | ||||||
|     :ok |     :ok | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user