Add test for AsciicastAnimationController
parent
66ac200733
commit
fbd8acf326
@ -0,0 +1,9 @@
|
||||
defmodule Asciinema.AsciicastAnimationControllerTest do
|
||||
use Asciinema.ConnCase
|
||||
|
||||
test "shows GIF generation instructions", %{conn: conn} do
|
||||
asciicast = fixture(:asciicast)
|
||||
conn = get conn, asciicast_animation_download_path(conn, asciicast)
|
||||
assert html_response(conn, 200) =~ "GIF"
|
||||
end
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
defmodule Asciinema.Fixtures do
|
||||
alias Asciinema.{Repo, Asciicast, User}
|
||||
|
||||
def fixture(:upload) do
|
||||
%Plug.Upload{path: "resources/welcome.json",
|
||||
filename: "welcome.json",
|
||||
content_type: "application/json"}
|
||||
end
|
||||
|
||||
def fixture(:user) do
|
||||
attrs = %{username: "test",
|
||||
auth_token: "authy-auth-auth"}
|
||||
Repo.insert!(User.changeset(%User{}, attrs))
|
||||
end
|
||||
|
||||
def fixture(:asciicast) do
|
||||
user = fixture(:user)
|
||||
upload = fixture(:upload)
|
||||
attrs = %{version: 1,
|
||||
duration: 123,
|
||||
terminal_columns: 80,
|
||||
terminal_lines: 24,
|
||||
file: upload.filename,
|
||||
secret_token: "v3ry-sekr1t",
|
||||
user_id: user.id}
|
||||
Repo.insert!(Asciicast.changeset(%Asciicast{}, attrs))
|
||||
end
|
||||
end
|
@ -1,7 +1,3 @@
|
||||
defmodule Asciinema.AsciicastAnimationView do
|
||||
use Asciinema.Web, :view
|
||||
|
||||
def asciicast_file_url(conn, asciicast) do
|
||||
"#{asciicast_url(conn, :show, asciicast)}.json" # TODO: use route helper
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue