Decrapify
This commit is contained in:
parent
17126d1b9c
commit
20ac755c28
3 changed files with 0 additions and 177 deletions
|
@ -1,59 +0,0 @@
|
||||||
defmodule GeoTherminator.PaskaTest do
|
|
||||||
use GeoTherminator.DataCase
|
|
||||||
|
|
||||||
alias GeoTherminator.Paska
|
|
||||||
|
|
||||||
describe "paskas" do
|
|
||||||
alias GeoTherminator.Paska.Crap
|
|
||||||
|
|
||||||
import GeoTherminator.PaskaFixtures
|
|
||||||
|
|
||||||
@invalid_attrs %{name: nil}
|
|
||||||
|
|
||||||
test "list_paskas/0 returns all paskas" do
|
|
||||||
crap = crap_fixture()
|
|
||||||
assert Paska.list_paskas() == [crap]
|
|
||||||
end
|
|
||||||
|
|
||||||
test "get_crap!/1 returns the crap with given id" do
|
|
||||||
crap = crap_fixture()
|
|
||||||
assert Paska.get_crap!(crap.id) == crap
|
|
||||||
end
|
|
||||||
|
|
||||||
test "create_crap/1 with valid data creates a crap" do
|
|
||||||
valid_attrs = %{name: "some name"}
|
|
||||||
|
|
||||||
assert {:ok, %Crap{} = crap} = Paska.create_crap(valid_attrs)
|
|
||||||
assert crap.name == "some name"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "create_crap/1 with invalid data returns error changeset" do
|
|
||||||
assert {:error, %Ecto.Changeset{}} = Paska.create_crap(@invalid_attrs)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "update_crap/2 with valid data updates the crap" do
|
|
||||||
crap = crap_fixture()
|
|
||||||
update_attrs = %{name: "some updated name"}
|
|
||||||
|
|
||||||
assert {:ok, %Crap{} = crap} = Paska.update_crap(crap, update_attrs)
|
|
||||||
assert crap.name == "some updated name"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "update_crap/2 with invalid data returns error changeset" do
|
|
||||||
crap = crap_fixture()
|
|
||||||
assert {:error, %Ecto.Changeset{}} = Paska.update_crap(crap, @invalid_attrs)
|
|
||||||
assert crap == Paska.get_crap!(crap.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "delete_crap/1 deletes the crap" do
|
|
||||||
crap = crap_fixture()
|
|
||||||
assert {:ok, %Crap{}} = Paska.delete_crap(crap)
|
|
||||||
assert_raise Ecto.NoResultsError, fn -> Paska.get_crap!(crap.id) end
|
|
||||||
end
|
|
||||||
|
|
||||||
test "change_crap/1 returns a crap changeset" do
|
|
||||||
crap = crap_fixture()
|
|
||||||
assert %Ecto.Changeset{} = Paska.change_crap(crap)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,8 +0,0 @@
|
||||||
defmodule GeoTherminatorWeb.PageControllerTest do
|
|
||||||
use GeoTherminatorWeb.ConnCase
|
|
||||||
|
|
||||||
test "GET /", %{conn: conn} do
|
|
||||||
conn = get(conn, "/")
|
|
||||||
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,110 +0,0 @@
|
||||||
defmodule GeoTherminatorWeb.CrapLiveTest do
|
|
||||||
use GeoTherminatorWeb.ConnCase
|
|
||||||
|
|
||||||
import Phoenix.LiveViewTest
|
|
||||||
import GeoTherminator.PaskaFixtures
|
|
||||||
|
|
||||||
@create_attrs %{name: "some name"}
|
|
||||||
@update_attrs %{name: "some updated name"}
|
|
||||||
@invalid_attrs %{name: nil}
|
|
||||||
|
|
||||||
defp create_crap(_) do
|
|
||||||
crap = crap_fixture()
|
|
||||||
%{crap: crap}
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "Index" do
|
|
||||||
setup [:create_crap]
|
|
||||||
|
|
||||||
test "lists all paskas", %{conn: conn, crap: crap} do
|
|
||||||
{:ok, _index_live, html} = live(conn, Routes.crap_index_path(conn, :index))
|
|
||||||
|
|
||||||
assert html =~ "Listing Paskas"
|
|
||||||
assert html =~ crap.name
|
|
||||||
end
|
|
||||||
|
|
||||||
test "saves new crap", %{conn: conn} do
|
|
||||||
{:ok, index_live, _html} = live(conn, Routes.crap_index_path(conn, :index))
|
|
||||||
|
|
||||||
assert index_live |> element("a", "New Crap") |> render_click() =~
|
|
||||||
"New Crap"
|
|
||||||
|
|
||||||
assert_patch(index_live, Routes.crap_index_path(conn, :new))
|
|
||||||
|
|
||||||
assert index_live
|
|
||||||
|> form("#crap-form", crap: @invalid_attrs)
|
|
||||||
|> render_change() =~ "can't be blank"
|
|
||||||
|
|
||||||
{:ok, _, html} =
|
|
||||||
index_live
|
|
||||||
|> form("#crap-form", crap: @create_attrs)
|
|
||||||
|> render_submit()
|
|
||||||
|> follow_redirect(conn, Routes.crap_index_path(conn, :index))
|
|
||||||
|
|
||||||
assert html =~ "Crap created successfully"
|
|
||||||
assert html =~ "some name"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "updates crap in listing", %{conn: conn, crap: crap} do
|
|
||||||
{:ok, index_live, _html} = live(conn, Routes.crap_index_path(conn, :index))
|
|
||||||
|
|
||||||
assert index_live |> element("#crap-#{crap.id} a", "Edit") |> render_click() =~
|
|
||||||
"Edit Crap"
|
|
||||||
|
|
||||||
assert_patch(index_live, Routes.crap_index_path(conn, :edit, crap))
|
|
||||||
|
|
||||||
assert index_live
|
|
||||||
|> form("#crap-form", crap: @invalid_attrs)
|
|
||||||
|> render_change() =~ "can't be blank"
|
|
||||||
|
|
||||||
{:ok, _, html} =
|
|
||||||
index_live
|
|
||||||
|> form("#crap-form", crap: @update_attrs)
|
|
||||||
|> render_submit()
|
|
||||||
|> follow_redirect(conn, Routes.crap_index_path(conn, :index))
|
|
||||||
|
|
||||||
assert html =~ "Crap updated successfully"
|
|
||||||
assert html =~ "some updated name"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "deletes crap in listing", %{conn: conn, crap: crap} do
|
|
||||||
{:ok, index_live, _html} = live(conn, Routes.crap_index_path(conn, :index))
|
|
||||||
|
|
||||||
assert index_live |> element("#crap-#{crap.id} a", "Delete") |> render_click()
|
|
||||||
refute has_element?(index_live, "#crap-#{crap.id}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "Show" do
|
|
||||||
setup [:create_crap]
|
|
||||||
|
|
||||||
test "displays crap", %{conn: conn, crap: crap} do
|
|
||||||
{:ok, _show_live, html} = live(conn, Routes.crap_show_path(conn, :show, crap))
|
|
||||||
|
|
||||||
assert html =~ "Show Crap"
|
|
||||||
assert html =~ crap.name
|
|
||||||
end
|
|
||||||
|
|
||||||
test "updates crap within modal", %{conn: conn, crap: crap} do
|
|
||||||
{:ok, show_live, _html} = live(conn, Routes.crap_show_path(conn, :show, crap))
|
|
||||||
|
|
||||||
assert show_live |> element("a", "Edit") |> render_click() =~
|
|
||||||
"Edit Crap"
|
|
||||||
|
|
||||||
assert_patch(show_live, Routes.crap_show_path(conn, :edit, crap))
|
|
||||||
|
|
||||||
assert show_live
|
|
||||||
|> form("#crap-form", crap: @invalid_attrs)
|
|
||||||
|> render_change() =~ "can't be blank"
|
|
||||||
|
|
||||||
{:ok, _, html} =
|
|
||||||
show_live
|
|
||||||
|> form("#crap-form", crap: @update_attrs)
|
|
||||||
|> render_submit()
|
|
||||||
|> follow_redirect(conn, Routes.crap_show_path(conn, :show, crap))
|
|
||||||
|
|
||||||
assert html =~ "Crap updated successfully"
|
|
||||||
assert html =~ "some updated name"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue