Skip to content
Snippets Groups Projects
Commit 9b408177 authored by Butler, Alexis (UG - Computer Science)'s avatar Butler, Alexis (UG - Computer Science)
Browse files

Wrote and passed admin dash controller tests

parent a7d5152d
No related branches found
No related tags found
No related merge requests found
require 'test_helper' require 'test_helper'
class Admin::DashboardControllerTest < ActionDispatch::IntegrationTest class Admin::DashboardControllerTest < ActionDispatch::IntegrationTest
test 'should get dashboard if logged in and admin' do test 'should get dashboard if logged in and admin' do
sign_in_as_admin
get admin_root_url
assert_response(:success)
assert_select 'h4' do
assert_select 'a', 4
end
end end
test 'should not get dashboard if logged in but not admin' do test 'should not get dashboard if logged in but not admin' do
sign_in_as_tester
get admin_root_url
assert_response(:redirect)
assert_redirected_to(root_url)
assert_equal 'You must be admin to go there!', flash[:danger]
end end
test 'should not get dashboard if not logged in' do test 'should not get dashboard if not logged in' do
get admin_root_url
assert_response(:redirect)
assert_redirected_to(login_url)
assert_equal 'Login to view this content', flash[:danger]
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment