Skip to content

Instantly share code, notes, and snippets.

@sprite2005
Created August 9, 2015 22:11
Show Gist options
  • Save sprite2005/f8ecf2fe4d25038c908c to your computer and use it in GitHub Desktop.
Save sprite2005/f8ecf2fe4d25038c908c to your computer and use it in GitHub Desktop.
require 'test_helper'
class Admin::DashboardControllerTest < ActionController::TestCase
test "should not get index without user" do
get :index
assert_redirected_to new_user_session_path
end
test "should not get index with regular user" do
sign_in_user
get :index
assert_redirected_to root_path
end
test "should not get index with vip user" do
sign_in_vip
get :index
assert_redirected_to root_path
end
test "should get index with moderator user" do
sign_in_admin
get :index
assert_response :success
end
test "should get index with admin user" do
sign_in_admin
get :index
assert_response :success
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment