Use aliases

This commit is contained in:
Claudio Ortolina
2025-02-20 15:19:06 +00:00
parent 26297a8bb1
commit b2daa561d7
4 changed files with 19 additions and 15 deletions
+3 -2
View File
@@ -2,13 +2,14 @@ defmodule MusicLibrary.Records.CoverTest do
use ExUnit.Case, async: true
import MusicLibrary.Fixtures.Records
alias MusicLibrary.Records.Cover
describe "resize/1" do
test "it resizes to the desired size" do
cover_data = File.read!(marbles_cover_fixture())
{:ok, resized_cover} = MusicLibrary.Records.Cover.resize(cover_data)
{:ok, resized_cover} = Cover.resize(cover_data)
assert cover_data !== resized_cover
assert MusicLibrary.Records.Cover.correct_size?(resized_cover)
assert Cover.correct_size?(resized_cover)
end
end
end
+4 -2
View File
@@ -16,6 +16,8 @@ defmodule MusicLibrary.DataCase do
use ExUnit.CaseTemplate
alias Ecto.Adapters.SQL.Sandbox
using do
quote do
alias MusicLibrary.Repo
@@ -36,8 +38,8 @@ defmodule MusicLibrary.DataCase do
Sets up the sandbox based on the test tags.
"""
def setup_sandbox(tags) do
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(MusicLibrary.Repo, shared: not tags[:async])
on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
pid = Sandbox.start_owner!(MusicLibrary.Repo, shared: not tags[:async])
on_exit(fn -> Sandbox.stop_owner(pid) end)
end
@doc """