mobilizon/test/mobilizon/service/users/tools.exs
Thomas Citharel bba6629046
Better docs
Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Nicer docs

No 3rd stage

Add mix.deps get before docs

Add :ex_doc on test env so that it runs into CI
2019-03-18 12:10:29 +01:00

29 lines
850 B
Elixir

defmodule Mobilizon.Service.Users.ToolsTest do
use Mobilizon.DataCase
import Mobilizon.Factory
setup do
user = insert(:user)
moderator = insert(:user, role: :moderator)
administrator = insert(:user, role: :administrator)
{:ok, user: user, moderator: moderator, administrator: administrator}
end
describe "test guards" do
import Mobilizon.Users.Guards
test "is_moderator/1 guard", %{user: user, moderator: moderator, administrator: administrator} do
refute is_moderator(user.role)
assert is_moderator(moderator.role)
assert is_moderator(administrator.role)
end
test "is_admin/1 guard", %{user: user, moderator: moderator, administrator: administrator} do
refute is_admin(user.role)
refute is_admin(moderator.role)
assert is_admin(administrator.role)
end
end
end