Skip to content

Commit

Permalink
Test for redirect to edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartc committed Feb 2, 2022
1 parent 464987a commit 55e2395
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/lightning_web/live/job_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,12 @@ defmodule LightningWeb.JobLiveTest do
test "updates job in listing", %{conn: conn, job: job} do
{:ok, index_live, _html} = live(conn, Routes.job_index_path(conn, :index))

{:ok, form_live, _} = index_live
|> element("#job-#{job.id} a", "Edit")
|> render_click()
|> follow_redirect(conn, Routes.job_edit_path(conn, :edit, job))

assert_redirected(index_live, Routes.job_edit_path(conn, :edit, job))
# Get a new LiveView as the `live_patch` call doesn't appear to have the
# new Edit component on it.
# {:ok, form_live, _html} = live(conn, Routes.job_edit_path(conn, :edit, job))
{:ok, form_live, _} =
index_live
|> element("#job-#{job.id} a", "Edit")
|> render_click()
|> follow_redirect(conn, Routes.job_edit_path(conn, :edit, job))

assert form_live
|> form("#job-form", job: @invalid_attrs)
|> render_change() =~ "can't be blank"
Expand Down

0 comments on commit 55e2395

Please sign in to comment.