legendary-doc-site/apps/content/test/content/options_test.exs
2020-07-28 10:54:24 -05:00

26 lines
494 B
Elixir

defmodule Content.OptionsTest do
use Content.DataCase
alias Content.{Option, Options, Repo}
def fixture(:option) do
%Option{}
|> Option.changeset(%{
name: "test_up",
value: "1",
})
|> Repo.insert!()
end
test "can get an option by name" do
fixture(:option)
assert Options.get_value("test_up") == "1"
end
test "can get an option by name as an int" do
fixture(:option)
assert Options.get_value_as_int("test_up") == {1, ""}
end
end