use slugs
This commit is contained in:
@ -7,19 +7,19 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
@create_attrs %{
|
||||
"content" => "some content",
|
||||
"tags_string" => "tag1",
|
||||
"title" => "some title",
|
||||
"slug" => "some-slug",
|
||||
"visibility" => :public
|
||||
}
|
||||
@update_attrs %{
|
||||
"content" => "some updated content",
|
||||
"tags_string" => "tag1,tag2",
|
||||
"title" => "some updated title",
|
||||
"slug" => "some-updated-slug",
|
||||
"visibility" => :private
|
||||
}
|
||||
@invalid_attrs %{
|
||||
"content" => nil,
|
||||
"tags_string" => "",
|
||||
"title" => nil,
|
||||
"slug" => nil,
|
||||
"visibility" => nil
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||
|
||||
assert html =~ "#{@create_attrs |> Map.get("title")} created"
|
||||
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
||||
assert html =~ "some content"
|
||||
end
|
||||
|
||||
@ -65,7 +65,7 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
assert index_live |> element("[data-qa=\"context-edit-#{context.id}\"]") |> render_click() =~
|
||||
"edit"
|
||||
|
||||
assert_patch(index_live, Routes.context_index_path(conn, :edit, context))
|
||||
assert_patch(index_live, Routes.context_index_path(conn, :edit, context.slug))
|
||||
|
||||
assert index_live
|
||||
|> form("#context-form", context: @invalid_attrs)
|
||||
@ -77,7 +77,7 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||
|
||||
assert html =~ "#{@update_attrs |> Map.get("title")} saved"
|
||||
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
||||
assert html =~ "some updated content"
|
||||
end
|
||||
|
||||
@ -93,18 +93,18 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
setup [:register_and_log_in_user, :create_context]
|
||||
|
||||
test "displays context", %{conn: conn, context: context} do
|
||||
{:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context))
|
||||
{:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
|
||||
assert html =~ "context"
|
||||
assert html =~ context.content
|
||||
end
|
||||
|
||||
test "updates context within modal", %{conn: conn, context: context} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.context_show_path(conn, :show, context))
|
||||
{:ok, show_live, _html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
|
||||
assert show_live |> element("a", "edit") |> render_click() =~ "edit"
|
||||
|
||||
assert_patch(show_live, Routes.context_show_path(conn, :edit, context))
|
||||
assert_patch(show_live, Routes.context_show_path(conn, :edit, context.slug))
|
||||
|
||||
assert show_live
|
||||
|> form("#context-form", context: @invalid_attrs)
|
||||
@ -112,16 +112,16 @@ defmodule MemexWeb.ContextLiveTest do
|
||||
|
||||
{:ok, _, html} =
|
||||
show_live
|
||||
|> form("#context-form", context: @update_attrs)
|
||||
|> form("#context-form", context: Map.put(@update_attrs, "slug", context.slug))
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.context_show_path(conn, :show, context))
|
||||
|> follow_redirect(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
|
||||
assert html =~ "#{@update_attrs |> Map.get("title")} saved"
|
||||
assert html =~ "#{context.slug} saved"
|
||||
assert html =~ "some updated content"
|
||||
end
|
||||
|
||||
test "deletes context", %{conn: conn, context: context} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.context_show_path(conn, :show, context))
|
||||
{:ok, show_live, _html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||
|
||||
{:ok, index_live, _html} =
|
||||
show_live
|
||||
|
@ -7,19 +7,19 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
@create_attrs %{
|
||||
"content" => "some content",
|
||||
"tags_string" => "tag1",
|
||||
"title" => "some title",
|
||||
"slug" => "some-slug",
|
||||
"visibility" => :public
|
||||
}
|
||||
@update_attrs %{
|
||||
"content" => "some updated content",
|
||||
"tags_string" => "tag1,tag2",
|
||||
"title" => "some updated title",
|
||||
"slug" => "some-updated-slug",
|
||||
"visibility" => :private
|
||||
}
|
||||
@invalid_attrs %{
|
||||
"content" => nil,
|
||||
"tags_string" => "",
|
||||
"title" => nil,
|
||||
"slug" => nil,
|
||||
"visibility" => nil
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||
|
||||
assert html =~ "#{@create_attrs |> Map.get("title")} created"
|
||||
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
||||
assert html =~ "some content"
|
||||
end
|
||||
|
||||
@ -65,7 +65,7 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
assert index_live |> element("[data-qa=\"note-edit-#{note.id}\"]") |> render_click() =~
|
||||
"edit"
|
||||
|
||||
assert_patch(index_live, Routes.note_index_path(conn, :edit, note))
|
||||
assert_patch(index_live, Routes.note_index_path(conn, :edit, note.slug))
|
||||
|
||||
assert index_live
|
||||
|> form("#note-form", note: @invalid_attrs)
|
||||
@ -77,7 +77,7 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||
|
||||
assert html =~ "#{@update_attrs |> Map.get("title")} saved"
|
||||
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
||||
assert html =~ "some updated content"
|
||||
end
|
||||
|
||||
@ -93,18 +93,18 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
setup [:register_and_log_in_user, :create_note]
|
||||
|
||||
test "displays note", %{conn: conn, note: note} do
|
||||
{:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note))
|
||||
{:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
|
||||
assert html =~ "note"
|
||||
assert html =~ note.content
|
||||
end
|
||||
|
||||
test "updates note within modal", %{conn: conn, note: note} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.note_show_path(conn, :show, note))
|
||||
{:ok, show_live, _html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
|
||||
assert show_live |> element("a", "edit") |> render_click() =~ "edit"
|
||||
|
||||
assert_patch(show_live, Routes.note_show_path(conn, :edit, note))
|
||||
assert_patch(show_live, Routes.note_show_path(conn, :edit, note.slug))
|
||||
|
||||
assert show_live
|
||||
|> form("#note-form", note: @invalid_attrs)
|
||||
@ -112,16 +112,16 @@ defmodule MemexWeb.NoteLiveTest do
|
||||
|
||||
{:ok, _, html} =
|
||||
show_live
|
||||
|> form("#note-form", note: @update_attrs)
|
||||
|> form("#note-form", note: Map.put(@update_attrs, "slug", note.slug))
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.note_show_path(conn, :show, note))
|
||||
|> follow_redirect(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
|
||||
assert html =~ "#{@update_attrs |> Map.get("title")} saved"
|
||||
assert html =~ "#{note.slug} saved"
|
||||
assert html =~ "some updated content"
|
||||
end
|
||||
|
||||
test "deletes note", %{conn: conn, note: note} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.note_show_path(conn, :show, note))
|
||||
{:ok, show_live, _html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||
|
||||
{:ok, index_live, _html} =
|
||||
show_live
|
||||
|
@ -7,19 +7,19 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
@create_attrs %{
|
||||
"description" => "some description",
|
||||
"tags_string" => "tag1",
|
||||
"title" => "some title",
|
||||
"slug" => "some-slug",
|
||||
"visibility" => :public
|
||||
}
|
||||
@update_attrs %{
|
||||
"description" => "some updated description",
|
||||
"tags_string" => "tag1,tag2",
|
||||
"title" => "some updated title",
|
||||
"slug" => "some-updated-slug",
|
||||
"visibility" => :private
|
||||
}
|
||||
@invalid_attrs %{
|
||||
"description" => nil,
|
||||
"tags_string" => "",
|
||||
"title" => nil,
|
||||
"slug" => nil,
|
||||
"visibility" => nil
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.pipeline_index_path(conn, :index))
|
||||
|
||||
assert html =~ "#{@create_attrs |> Map.get("title")} created"
|
||||
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
||||
assert html =~ "some description"
|
||||
end
|
||||
|
||||
@ -65,7 +65,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
assert index_live |> element("[data-qa=\"pipeline-edit-#{pipeline.id}\"]") |> render_click() =~
|
||||
"edit"
|
||||
|
||||
assert_patch(index_live, Routes.pipeline_index_path(conn, :edit, pipeline))
|
||||
assert_patch(index_live, Routes.pipeline_index_path(conn, :edit, pipeline.slug))
|
||||
|
||||
assert index_live
|
||||
|> form("#pipeline-form", pipeline: @invalid_attrs)
|
||||
@ -77,7 +77,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.pipeline_index_path(conn, :index))
|
||||
|
||||
assert html =~ "#{@update_attrs |> Map.get("title")} saved"
|
||||
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
||||
assert html =~ "some updated description"
|
||||
end
|
||||
|
||||
@ -96,18 +96,18 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
setup [:register_and_log_in_user, :create_pipeline]
|
||||
|
||||
test "displays pipeline", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, _show_live, html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline))
|
||||
{:ok, _show_live, html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|
||||
assert html =~ "pipeline"
|
||||
assert html =~ pipeline.description
|
||||
end
|
||||
|
||||
test "updates pipeline within modal", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline))
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|
||||
assert show_live |> element("a", "edit") |> render_click() =~ "edit"
|
||||
|
||||
assert_patch(show_live, Routes.pipeline_show_path(conn, :edit, pipeline))
|
||||
assert_patch(show_live, Routes.pipeline_show_path(conn, :edit, pipeline.slug))
|
||||
|
||||
assert show_live
|
||||
|> form("#pipeline-form", pipeline: @invalid_attrs)
|
||||
@ -115,16 +115,16 @@ defmodule MemexWeb.PipelineLiveTest do
|
||||
|
||||
{:ok, _, html} =
|
||||
show_live
|
||||
|> form("#pipeline-form", pipeline: @update_attrs)
|
||||
|> form("#pipeline-form", pipeline: Map.put(@update_attrs, "slug", pipeline.slug))
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, Routes.pipeline_show_path(conn, :show, pipeline))
|
||||
|> follow_redirect(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|
||||
assert html =~ "#{@update_attrs |> Map.get("title")} saved"
|
||||
assert html =~ "#{pipeline.slug} saved"
|
||||
assert html =~ "some updated description"
|
||||
end
|
||||
|
||||
test "deletes pipeline", %{conn: conn, pipeline: pipeline} do
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline))
|
||||
{:ok, show_live, _html} = live(conn, Routes.pipeline_show_path(conn, :show, pipeline.slug))
|
||||
|
||||
{:ok, index_live, _html} =
|
||||
show_live
|
||||
|
Reference in New Issue
Block a user