Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
defmodule Phoenix.Integration.CodeGeneration.AppWithSQLite3AdapterTest do
use Phoenix.Integration.CodeGeneratorCase, async: true

defp increase_busy_timeout(app_root_path) do
modify_file(Path.join(app_root_path, "config/test.exs"), fn file ->
String.replace(file, "config :dayzee, Dayzee.Repo,", """
config :dayzee, Dayzee.Repo,
busy_timeout: 10_000,
queue_target: 500
""")
end)
end

describe "phx.gen.html" do
@tag database: :sqlite3
test "has a passing test suite" do
with_installer_tmp("app_with_defaults", fn tmp_dir ->
{app_root_path, _} =
generate_phoenix_app(tmp_dir, "default_sqlite3_app", ["--database", "sqlite3"])

mix_run!(~w(phx.gen.html Blog Post posts title body:string status:enum:unpublished:published:deleted), app_root_path)
increase_busy_timeout(app_root_path)

mix_run!(
~w(phx.gen.html Blog Post posts title body:string status:enum:unpublished:published:deleted),
app_root_path
)

modify_file(Path.join(app_root_path, "lib/default_sqlite3_app_web/router.ex"), fn file ->
inject_before_final_end(file, """
Expand All @@ -34,7 +49,12 @@ defmodule Phoenix.Integration.CodeGeneration.AppWithSQLite3AdapterTest do
{app_root_path, _} =
generate_phoenix_app(tmp_dir, "default_sqlite3_app", ["--database", "sqlite3"])

mix_run!(~w(phx.gen.json Blog Post posts title body:string status:enum:unpublished:published:deleted), app_root_path)
increase_busy_timeout(app_root_path)

mix_run!(
~w(phx.gen.json Blog Post posts title body:string status:enum:unpublished:published:deleted),
app_root_path
)

modify_file(Path.join(app_root_path, "lib/default_sqlite3_app_web/router.ex"), fn file ->
inject_before_final_end(file, """
Expand All @@ -60,7 +80,12 @@ defmodule Phoenix.Integration.CodeGeneration.AppWithSQLite3AdapterTest do
{app_root_path, _} =
generate_phoenix_app(tmp_dir, "default_sqlite3_app", ["--database", "sqlite3", "--live"])

mix_run!(~w(phx.gen.live Blog Post posts title body:string status:enum:unpublished:published:deleted), app_root_path)
increase_busy_timeout(app_root_path)

mix_run!(
~w(phx.gen.live Blog Post posts title body:string status:enum:unpublished:published:deleted),
app_root_path
)

modify_file(Path.join(app_root_path, "lib/default_sqlite3_app_web/router.ex"), fn file ->
inject_before_final_end(file, """
Expand Down Expand Up @@ -108,7 +133,10 @@ defmodule Phoenix.Integration.CodeGeneration.AppWithSQLite3AdapterTest do
@tag database: :sqlite3
test "has a passing test suite (--live)" do
with_installer_tmp("app_with_defaults", fn tmp_dir ->
{app_root_path, _} = generate_phoenix_app(tmp_dir, "default_app", ["--database", "sqlite3"])
{app_root_path, _} =
generate_phoenix_app(tmp_dir, "default_app", ["--database", "sqlite3"])

increase_busy_timeout(app_root_path)

mix_run!(~w(phx.gen.auth Accounts User users --live), app_root_path)

Expand All @@ -119,7 +147,10 @@ defmodule Phoenix.Integration.CodeGeneration.AppWithSQLite3AdapterTest do

test "has a passing test suite (--no-live)" do
with_installer_tmp("app_with_defaults", fn tmp_dir ->
{app_root_path, _} = generate_phoenix_app(tmp_dir, "default_app", ["--database", "sqlite3"])
{app_root_path, _} =
generate_phoenix_app(tmp_dir, "default_app", ["--database", "sqlite3"])

increase_busy_timeout(app_root_path)

mix_run!(~w(phx.gen.auth Accounts User users --no-live), app_root_path)

Expand Down
Loading