skill-assessment-app/test/models/user_test.rb

83 lines
1.6 KiB
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
2016-07-26 17:00:00 -05:00
require 'test_helper'
class UserTest < ActiveSupport::TestCase
2016-09-22 17:26:00 -05:00
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
2016-11-20 13:07:53 -06:00
test 'manager should act as manager and reviewer' do
2016-09-22 17:26:00 -05:00
user = users(:manager)
assert user.acts_as_manager?
2016-11-20 13:07:53 -06:00
assert user.acts_as_reviewer?
2016-09-22 17:26:00 -05:00
refute user.acts_as_admin?
refute user.acts_as_recruiter?
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
2016-07-26 17:00:00 -05:00
end