defmodule MyApp.EctoEnumsTest do
use MyApp.DataCase
describe "PostStatusEnum" do
alias MyApp.MyContext.Post
test "raises when input is not in the enum map" do
error = {:status, {"is invalid", [type: PostStatusEnum, validation: :cast]}}
changeset = Ecto.Changeset.cast(%Post{}, %{"status" => "a_not_valid_status"}, [:status])
assert error in changeset.errors
end
test "doesn't raise when input is in the enum map" do
changeset = Ecto.Changeset.cast(%Post{}, %{"status" => "importing"}, [:status])
assert length(changeset.errors) == 0
changeset = Ecto.Changeset.cast(%Post{}, %{"status" => :importing}, [:status])
assert length(changeset.errors) == 0
end
end
end
Tests pass, im happy with that. But coverage reporting tool is showing 0% for ecto_enums.ex
I have the following
ecto_enums.ex
fileTests pass, im happy with that. But coverage reporting tool is showing 0% for
ecto_enums.ex
How can I make coverage tool put a 100% in my
ecto_enums.ex
?