rename project from SimpleshopTheme to Berrypod
All modules, configs, paths, and references updated. 836 tests pass, zero warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
defmodule SimpleshopThemeWeb.ConnCase do
|
||||
defmodule BerrypodWeb.ConnCase do
|
||||
@moduledoc """
|
||||
This module defines the test case to be used by
|
||||
tests that require setting up a connection.
|
||||
@@ -11,7 +11,7 @@ defmodule SimpleshopThemeWeb.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 SimpleshopThemeWeb.ConnCase, async: true`, although
|
||||
by setting `use BerrypodWeb.ConnCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
@@ -20,19 +20,19 @@ defmodule SimpleshopThemeWeb.ConnCase do
|
||||
using do
|
||||
quote do
|
||||
# The default endpoint for testing
|
||||
@endpoint SimpleshopThemeWeb.Endpoint
|
||||
@endpoint BerrypodWeb.Endpoint
|
||||
|
||||
use SimpleshopThemeWeb, :verified_routes
|
||||
use BerrypodWeb, :verified_routes
|
||||
|
||||
# Import conveniences for testing with connections
|
||||
import Plug.Conn
|
||||
import Phoenix.ConnTest
|
||||
import SimpleshopThemeWeb.ConnCase
|
||||
import BerrypodWeb.ConnCase
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
SimpleshopTheme.DataCase.setup_sandbox(tags)
|
||||
Berrypod.DataCase.setup_sandbox(tags)
|
||||
{:ok, conn: Phoenix.ConnTest.build_conn()}
|
||||
end
|
||||
|
||||
@@ -45,8 +45,8 @@ defmodule SimpleshopThemeWeb.ConnCase do
|
||||
test context.
|
||||
"""
|
||||
def register_and_log_in_user(%{conn: conn} = context) do
|
||||
user = SimpleshopTheme.AccountsFixtures.user_fixture()
|
||||
scope = SimpleshopTheme.Accounts.Scope.for_user(user)
|
||||
user = Berrypod.AccountsFixtures.user_fixture()
|
||||
scope = Berrypod.Accounts.Scope.for_user(user)
|
||||
|
||||
opts =
|
||||
context
|
||||
@@ -62,7 +62,7 @@ defmodule SimpleshopThemeWeb.ConnCase do
|
||||
It returns an updated `conn`.
|
||||
"""
|
||||
def log_in_user(conn, user, opts \\ []) do
|
||||
token = SimpleshopTheme.Accounts.generate_user_session_token(user)
|
||||
token = Berrypod.Accounts.generate_user_session_token(user)
|
||||
|
||||
maybe_set_token_authenticated_at(token, opts[:token_authenticated_at])
|
||||
|
||||
@@ -74,6 +74,6 @@ defmodule SimpleshopThemeWeb.ConnCase do
|
||||
defp maybe_set_token_authenticated_at(_token, nil), do: nil
|
||||
|
||||
defp maybe_set_token_authenticated_at(token, authenticated_at) do
|
||||
SimpleshopTheme.AccountsFixtures.override_token_authenticated_at(token, authenticated_at)
|
||||
Berrypod.AccountsFixtures.override_token_authenticated_at(token, authenticated_at)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule SimpleshopTheme.DataCase do
|
||||
defmodule Berrypod.DataCase do
|
||||
@moduledoc """
|
||||
This module defines the setup for tests requiring
|
||||
access to the application's data layer.
|
||||
@@ -10,7 +10,7 @@ defmodule SimpleshopTheme.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 SimpleshopTheme.DataCase, async: true`, although
|
||||
by setting `use Berrypod.DataCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
@@ -18,17 +18,17 @@ defmodule SimpleshopTheme.DataCase do
|
||||
|
||||
using do
|
||||
quote do
|
||||
alias SimpleshopTheme.Repo
|
||||
alias Berrypod.Repo
|
||||
|
||||
import Ecto
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
import SimpleshopTheme.DataCase
|
||||
import Berrypod.DataCase
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
SimpleshopTheme.DataCase.setup_sandbox(tags)
|
||||
Berrypod.DataCase.setup_sandbox(tags)
|
||||
:ok
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ defmodule SimpleshopTheme.DataCase do
|
||||
Sets up the sandbox based on the test tags.
|
||||
"""
|
||||
def setup_sandbox(tags) do
|
||||
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(SimpleshopTheme.Repo, shared: not tags[:async])
|
||||
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Berrypod.Repo, shared: not tags[:async])
|
||||
on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
defmodule SimpleshopTheme.AccountsFixtures do
|
||||
defmodule Berrypod.AccountsFixtures do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `SimpleshopTheme.Accounts` context.
|
||||
entities via the `Berrypod.Accounts` context.
|
||||
"""
|
||||
|
||||
import Ecto.Query
|
||||
|
||||
alias SimpleshopTheme.Accounts
|
||||
alias SimpleshopTheme.Accounts.Scope
|
||||
alias Berrypod.Accounts
|
||||
alias Berrypod.Accounts.Scope
|
||||
|
||||
def unique_user_email, do: "user#{System.unique_integer()}@example.com"
|
||||
def valid_user_password, do: "hello world!"
|
||||
@@ -64,7 +64,7 @@ defmodule SimpleshopTheme.AccountsFixtures do
|
||||
end
|
||||
|
||||
def override_token_authenticated_at(token, authenticated_at) when is_binary(token) do
|
||||
SimpleshopTheme.Repo.update_all(
|
||||
Berrypod.Repo.update_all(
|
||||
from(t in Accounts.UserToken,
|
||||
where: t.token == ^token
|
||||
),
|
||||
@@ -74,14 +74,14 @@ defmodule SimpleshopTheme.AccountsFixtures do
|
||||
|
||||
def generate_user_magic_link_token(user) do
|
||||
{encoded_token, user_token} = Accounts.UserToken.build_email_token(user, "login")
|
||||
SimpleshopTheme.Repo.insert!(user_token)
|
||||
Berrypod.Repo.insert!(user_token)
|
||||
{encoded_token, user_token.token}
|
||||
end
|
||||
|
||||
def offset_user_token(token, amount_to_add, unit) do
|
||||
dt = DateTime.add(DateTime.utc_now(:second), amount_to_add, unit)
|
||||
|
||||
SimpleshopTheme.Repo.update_all(
|
||||
Berrypod.Repo.update_all(
|
||||
from(ut in Accounts.UserToken, where: ut.token == ^token),
|
||||
set: [inserted_at: dt, authenticated_at: dt]
|
||||
)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
defmodule SimpleshopTheme.ImageFixtures do
|
||||
defmodule Berrypod.ImageFixtures do
|
||||
@moduledoc """
|
||||
Shared fixtures for image-related tests.
|
||||
"""
|
||||
|
||||
alias SimpleshopTheme.Repo
|
||||
alias SimpleshopTheme.Media.Image
|
||||
alias Berrypod.Repo
|
||||
alias Berrypod.Media.Image
|
||||
|
||||
@sample_jpeg File.read!("test/fixtures/sample_1200x800.jpg")
|
||||
|
||||
def sample_jpeg, do: @sample_jpeg
|
||||
|
||||
def image_fixture(attrs \\ %{}) do
|
||||
{:ok, webp, w, h} = SimpleshopTheme.Images.Optimizer.to_optimized_webp(@sample_jpeg)
|
||||
{:ok, webp, w, h} = Berrypod.Images.Optimizer.to_optimized_webp(@sample_jpeg)
|
||||
|
||||
defaults = %{
|
||||
image_type: "product",
|
||||
@@ -63,11 +63,11 @@ defmodule SimpleshopTheme.ImageFixtures do
|
||||
_ -> "#{id}-#{width}.#{ext}"
|
||||
end
|
||||
|
||||
Path.join(SimpleshopTheme.Images.Optimizer.cache_dir(), filename)
|
||||
Path.join(Berrypod.Images.Optimizer.cache_dir(), filename)
|
||||
end
|
||||
|
||||
def cleanup_cache do
|
||||
cache_dir = SimpleshopTheme.Images.Optimizer.cache_dir()
|
||||
cache_dir = Berrypod.Images.Optimizer.cache_dir()
|
||||
if File.exists?(cache_dir), do: File.rm_rf!(cache_dir)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
defmodule SimpleshopTheme.OrdersFixtures do
|
||||
defmodule Berrypod.OrdersFixtures do
|
||||
@moduledoc """
|
||||
Test helpers for creating orders.
|
||||
"""
|
||||
|
||||
alias SimpleshopTheme.Orders
|
||||
alias Berrypod.Orders
|
||||
|
||||
import SimpleshopTheme.ProductsFixtures
|
||||
import Berrypod.ProductsFixtures
|
||||
|
||||
def order_fixture(attrs \\ %{}) do
|
||||
attrs = Enum.into(attrs, %{})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule SimpleshopTheme.ProductsFixtures do
|
||||
defmodule Berrypod.ProductsFixtures do
|
||||
@moduledoc """
|
||||
Test helpers for creating entities via the `SimpleshopTheme.Products` context.
|
||||
Test helpers for creating entities via the `Berrypod.Products` context.
|
||||
"""
|
||||
|
||||
alias SimpleshopTheme.Products
|
||||
alias Berrypod.Products
|
||||
|
||||
def unique_provider_product_id, do: "prov_#{System.unique_integer([:positive])}"
|
||||
def unique_slug, do: "product-#{System.unique_integer([:positive])}"
|
||||
@@ -186,7 +186,7 @@ defmodule SimpleshopTheme.ProductsFixtures do
|
||||
end
|
||||
|
||||
# Return product with preloaded associations
|
||||
SimpleshopTheme.Repo.preload(product, [:images, :variants])
|
||||
Berrypod.Repo.preload(product, [:images, :variants])
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Mox.defmock(SimpleshopTheme.Providers.MockProvider,
|
||||
for: SimpleshopTheme.Providers.Provider
|
||||
Mox.defmock(Berrypod.Providers.MockProvider,
|
||||
for: Berrypod.Providers.Provider
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user