SHARE
TWEET

Untitled

a guest May 19th, 2017 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. defmodule Catcasts.VideoControllerTest do
  2.   use Catcasts.ConnCase
  3.  
  4.   alias Catcasts.Video
  5.  
  6.   ... # Code removed for readability
  7.  
  8.  
  9.   test "shows chosen resource", %{conn: conn} do
  10.     video = insert(:video)
  11.  
  12.     conn = get conn, video_path(conn, :show, video)
  13.     assert html_response(conn, 200) =~ "Show video"
  14.   end
  15.  
  16.   ... # Code removed for readability
  17.  
  18.  
  19.   test "deletes chosen resource", %{conn: conn} do
  20.     user = insert(:user)
  21.     video = insert(:video, user: user)
  22.  
  23.     conn = conn
  24.     |> assign(:user, user)
  25.     |> delete(video_path(conn, :delete, video))
  26.     assert redirected_to(conn) == video_path(conn, :index)
  27.     refute Repo.get(Video, video.id)
  28.   end
  29. end
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top