2016-09-21 17:04:08 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class DashboardControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
test "dashboard should require auth" do
|
|
|
|
get admin_url
|
|
|
|
assert_redirected_to admin_login_url
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get dashboard" do
|
|
|
|
post admin_auth_url, params: { auth:
|
|
|
|
{ email: 'alan.admin@mailinator.com', password: 'password' } }
|
2016-09-22 16:29:19 -05:00
|
|
|
get admin_users_url
|
2016-09-21 17:04:08 -05:00
|
|
|
assert_response :success
|
|
|
|
end
|
2016-09-22 17:26:00 -05:00
|
|
|
|
|
|
|
test "admin should redirect to users" do
|
|
|
|
auth_admin
|
|
|
|
get admin_url
|
|
|
|
|
|
|
|
assert_redirected_to admin_users_path
|
|
|
|
end
|
|
|
|
|
|
|
|
test "manager should redirect to quizzes" do
|
|
|
|
auth_manager
|
|
|
|
get admin_url
|
|
|
|
|
|
|
|
assert_redirected_to admin_quizzes_path
|
|
|
|
end
|
|
|
|
|
|
|
|
test "reviewer should redirect to results" do
|
|
|
|
auth_reviewer
|
|
|
|
get admin_url
|
|
|
|
|
|
|
|
assert_redirected_to admin_results_path
|
|
|
|
end
|
|
|
|
|
|
|
|
test "recruiter should redirect to candidates" do
|
|
|
|
auth_recruiter
|
|
|
|
get admin_url
|
|
|
|
|
|
|
|
assert_redirected_to admin_candidates_path
|
|
|
|
end
|
2016-09-21 17:04:08 -05:00
|
|
|
end
|
|
|
|
end
|