skill-assessment-app/test/models/user_test.rb
2016-09-22 17:26:00 -05:00

83 lines
1.6 KiB
Ruby

# frozen_string_literal: true
require 'test_helper'
class UserTest < ActiveSupport::TestCase
test 'admin should act as any role' do
user = users(:admin)
assert user.acts_as_admin?
assert user.acts_as_manager?
assert user.acts_as_recruiter?
assert user.acts_as_reviewer?
end
test 'admin should only be admin' do
user = users(:admin)
assert user.admin?
refute user.manager?
refute user.recruiter?
refute user.reviewer?
end
test 'manager should act as manager' do
user = users(:manager)
assert user.acts_as_manager?
refute user.acts_as_admin?
refute user.acts_as_recruiter?
refute user.acts_as_reviewer?
end
test 'manager should only be manager' do
user = users(:manager)
assert user.manager?
refute user.admin?
refute user.recruiter?
refute user.reviewer?
end
test 'recruiter should act as recruiter' do
user = users(:recruiter)
assert user.acts_as_recruiter?
refute user.acts_as_manager?
refute user.acts_as_admin?
refute user.acts_as_reviewer?
end
test 'recruiter should only be recruiter' do
user = users(:recruiter)
assert user.recruiter?
refute user.admin?
refute user.manager?
refute user.reviewer?
end
test 'reviewer should act as reviewer' do
user = users(:reviewer)
assert user.acts_as_reviewer?
refute user.acts_as_manager?
refute user.acts_as_admin?
refute user.acts_as_recruiter?
end
test 'reviewer should only be reviewer' do
user = users(:reviewer)
assert user.reviewer?
refute user.admin?
refute user.manager?
refute user.recruiter?
end
end