Skip to content

Commit

Permalink
Add tests for Torch.PageView
Browse files Browse the repository at this point in the history
  • Loading branch information
danielberkompas committed Apr 26, 2018
1 parent 182fd6c commit 62217c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/torch/views/page_view.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
defmodule Torch.PageView do
@doc """
Takes the controller action name and
appends it to the torch- prefix.
Takes the controller action name and appends it to the torch- prefix.
## Example
iex> body_classes(%Plug.Conn{private: %{phoenix_action: :create}})
"torch-create"
"""
@spec body_classes(Plug.Conn.t()) :: String.t()
def body_classes(conn) do
"torch-#{action_name(conn)}"
|> String.trim()
Expand All @@ -14,4 +19,4 @@ defmodule Torch.PageView do
|> Atom.to_string()
|> String.replace("_", "-")
end
end
end
5 changes: 5 additions & 0 deletions test/torch/views/page_view_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule Torch.PageViewTest do
use ExUnit.Case

doctest Torch.PageView, import: true
end

0 comments on commit 62217c6

Please sign in to comment.