Packages

This is a CMS written in Elixir. Aims to be the great open-source ecommerce and/or startup solution for those who are searching for a performance and stability on top of modern technologies like React and Elixir.

Current section

Files

Jump to
lyn test models role_checker_test.exs
Raw

test/models/role_checker_test.exs

defmodule Lyn.RoleCheckerTest do
use Lyn.ModelCase
alias Lyn.RoleChecker
alias Lyn.Factory
test "is_admin? is true when user has an admin role" do
role = Factory.create(:role, admin: true)
user = Factory.create(:user, email: "test@test.com", username: "user", password: "test", password_confirmation: "test", role: role)
assert RoleChecker.is_admin?(user)
end
test "is_admin? is false when user does not have an admin role" do
role = Factory.create(:role, admin: false)
user = Factory.create(:user, email: "test@test.com", username: "user", password: "test", password_confirmation: "test", role: role)
refute RoleChecker.is_admin?(user)
end
end