rename to cannery

This commit is contained in:
2023-02-25 15:47:37 -05:00
parent bc034c0361
commit a778f5a61f
128 changed files with 999 additions and 998 deletions

View File

@ -1,4 +1,4 @@
defmodule LokalWeb.ChannelCase do
defmodule CanneryWeb.ChannelCase do
@moduledoc """
This module defines the test case to be used by
channel tests.
@ -11,7 +11,7 @@ defmodule LokalWeb.ChannelCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use LokalWeb.ChannelCase, async: true`, although
by setting `use CanneryWeb.ChannelCase, async: true`, although
this option is not recommended for other databases.
"""
@ -22,15 +22,15 @@ defmodule LokalWeb.ChannelCase do
quote do
# Import conveniences for testing with channels
import Phoenix.ChannelTest
import LokalWeb.ChannelCase
import CanneryWeb.ChannelCase
# The default endpoint for testing
@endpoint LokalWeb.Endpoint
@endpoint CanneryWeb.Endpoint
end
end
setup tags do
pid = Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async])
pid = Sandbox.start_owner!(Cannery.Repo, shared: not tags[:async])
on_exit(fn -> Sandbox.stop_owner(pid) end)
:ok
end

View File

@ -1,4 +1,4 @@
defmodule LokalWeb.ConnCase do
defmodule CanneryWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
@ -11,14 +11,14 @@ defmodule LokalWeb.ConnCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use LokalWeb.ConnCase, async: true`, although
by setting `use CanneryWeb.ConnCase, async: true`, although
this option is not recommended for other databases.
"""
use ExUnit.CaseTemplate
import Lokal.Fixtures
import Cannery.Fixtures
alias Ecto.Adapters.SQL.Sandbox
alias Lokal.{Accounts, Accounts.User, Repo}
alias Cannery.{Accounts, Accounts.User, Repo}
using do
quote do
@ -26,18 +26,18 @@ defmodule LokalWeb.ConnCase do
import Plug.Conn
import Phoenix.ConnTest
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
import Lokal.Fixtures
import LokalWeb.ConnCase
import Cannery.Fixtures
import CanneryWeb.ConnCase
alias LokalWeb.Router.Helpers, as: Routes
alias CanneryWeb.Router.Helpers, as: Routes
# The default endpoint for testing
@endpoint LokalWeb.Endpoint
@endpoint CanneryWeb.Endpoint
end
end
setup tags do
pid = Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async])
pid = Sandbox.start_owner!(Cannery.Repo, shared: not tags[:async])
on_exit(fn -> Sandbox.stop_owner(pid) end)
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
@ -69,7 +69,7 @@ defmodule LokalWeb.ConnCase do
It returns an updated `conn`.
"""
def log_in_user(conn, user) do
token = Lokal.Accounts.generate_user_session_token(user)
token = Cannery.Accounts.generate_user_session_token(user)
conn
|> Phoenix.ConnTest.init_test_session(%{})

View File

@ -1,4 +1,4 @@
defmodule Lokal.DataCase do
defmodule Cannery.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
@ -10,7 +10,7 @@ defmodule Lokal.DataCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use Lokal.DataCase, async: true`, although
by setting `use Cannery.DataCase, async: true`, although
this option is not recommended for other databases.
"""
@ -19,16 +19,16 @@ defmodule Lokal.DataCase do
using do
quote do
alias Lokal.Repo
alias Cannery.Repo
import Ecto
import Ecto.{Changeset, Query}
import Lokal.{DataCase, Fixtures}
import Cannery.{DataCase, Fixtures}
end
end
setup tags do
pid = Sandbox.start_owner!(Lokal.Repo, shared: not tags[:async])
pid = Sandbox.start_owner!(Cannery.Repo, shared: not tags[:async])
on_exit(fn -> Sandbox.stop_owner(pid) end)
:ok
end

View File

@ -1,9 +1,9 @@
defmodule Lokal.Fixtures do
defmodule Cannery.Fixtures do
@moduledoc """
This module defines test helpers for creating entities
"""
alias Lokal.{Accounts, Accounts.User, Email, Repo}
alias Cannery.{Accounts, Accounts.User, Email, Repo}
def unique_user_email, do: "user#{System.unique_integer()}@example.com"
def valid_user_password, do: "hello world!"