fix module aliasing issues
This commit is contained in:
@@ -10,7 +10,8 @@ defmodule FirehoseWeb.BlogControllerTest do
|
||||
|
||||
describe "GET /blog/:blog_id/:slug (show) - date filtering" do
|
||||
test "still shows a future-dated post by slug", %{conn: conn} do
|
||||
assert conn |> get(~p"/blog/engineering/future-test-post") |> html_response(200) =~ "Future Test Post"
|
||||
assert conn |> get(~p"/blog/engineering/future-test-post") |> html_response(200) =~
|
||||
"Future Test Post"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -59,7 +59,9 @@ defmodule FirehoseWeb.UserRegistrationControllerTest do
|
||||
Application.put_env(:firehose, :allowed_registration_email, "allowed@example.com")
|
||||
on_exit(fn -> Application.delete_env(:firehose, :allowed_registration_email) end)
|
||||
|
||||
response = conn |> post(~p"/users/register", %{"user" => %{"email" => "allowed@example.com"}})
|
||||
response =
|
||||
conn |> post(~p"/users/register", %{"user" => %{"email" => "allowed@example.com"}})
|
||||
|
||||
assert Phoenix.Flash.get(response.assigns.flash, :info) =~ "email was sent"
|
||||
end
|
||||
|
||||
@@ -67,13 +69,17 @@ defmodule FirehoseWeb.UserRegistrationControllerTest do
|
||||
Application.put_env(:firehose, :allowed_registration_email, "allowed@example.com")
|
||||
on_exit(fn -> Application.delete_env(:firehose, :allowed_registration_email) end)
|
||||
|
||||
assert conn |> post(~p"/users/register", %{"user" => %{"email" => "other@example.com"}}) |> html_response(200) =~ "registration is invite only"
|
||||
assert conn
|
||||
|> post(~p"/users/register", %{"user" => %{"email" => "other@example.com"}})
|
||||
|> html_response(200) =~ "registration is invite only"
|
||||
end
|
||||
|
||||
test "fails with invite-only message when env var is unset", %{conn: conn} do
|
||||
Application.delete_env(:firehose, :allowed_registration_email)
|
||||
|
||||
assert conn |> post(~p"/users/register", %{"user" => %{"email" => "anyone@example.com"}}) |> html_response(200) =~ "registration is invite only"
|
||||
assert conn
|
||||
|> post(~p"/users/register", %{"user" => %{"email" => "anyone@example.com"}})
|
||||
|> html_response(200) =~ "registration is invite only"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,7 +46,8 @@ defmodule FirehoseWeb.UserSessionControllerTest do
|
||||
Accounts.deliver_login_instructions(user, url)
|
||||
end)
|
||||
|
||||
assert conn |> get(~p"/users/log-in/#{token}") |> html_response(200) =~ "Confirm and stay logged in"
|
||||
assert conn |> get(~p"/users/log-in/#{token}") |> html_response(200) =~
|
||||
"Confirm and stay logged in"
|
||||
end
|
||||
|
||||
test "renders login page for confirmed user", %{conn: conn, user: user} do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
alias Firehose.Test.FakeBlog
|
||||
|
||||
defmodule FirehoseWeb.EditorDashboardLiveTest do
|
||||
use FirehoseWeb.ConnCase, async: true
|
||||
|
||||
@@ -41,13 +43,13 @@ defmodule FirehoseWeb.EditorDashboardLiveTest do
|
||||
]
|
||||
|
||||
{:ok, _} =
|
||||
Firehose.Test.FakeBlog.start(posts,
|
||||
FakeBlog.start(posts,
|
||||
blog_id: :test_blog,
|
||||
title: "Test Blog",
|
||||
base_path: "/blog/test"
|
||||
)
|
||||
|
||||
Application.put_env(:blogex, :blogs, [Firehose.Test.FakeBlog])
|
||||
Application.put_env(:blogex, :blogs, [FakeBlog])
|
||||
on_exit(fn -> Application.delete_env(:blogex, :blogs) end)
|
||||
|
||||
:ok
|
||||
|
||||
@@ -15,6 +15,9 @@ defmodule FirehoseWeb.ConnCase do
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
alias Firehose.Accounts.Scope
|
||||
alias Firehose.AccountsFixtures
|
||||
|
||||
use ExUnit.CaseTemplate
|
||||
|
||||
using do
|
||||
@@ -45,8 +48,8 @@ defmodule FirehoseWeb.ConnCase do
|
||||
test context.
|
||||
"""
|
||||
def register_and_log_in_user(%{conn: conn} = context) do
|
||||
user = Firehose.AccountsFixtures.user_fixture()
|
||||
scope = Firehose.Accounts.Scope.for_user(user)
|
||||
user = AccountsFixtures.user_fixture()
|
||||
scope = Scope.for_user(user)
|
||||
|
||||
opts =
|
||||
context
|
||||
@@ -74,6 +77,6 @@ defmodule FirehoseWeb.ConnCase do
|
||||
defp maybe_set_token_authenticated_at(_token, nil), do: nil
|
||||
|
||||
defp maybe_set_token_authenticated_at(token, authenticated_at) do
|
||||
Firehose.AccountsFixtures.override_token_authenticated_at(token, authenticated_at)
|
||||
AccountsFixtures.override_token_authenticated_at(token, authenticated_at)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user