+ fixtures :users, :user_roles, :issues
+
+ def test_view_dashboard_without_auth
+ # Access issues_path without login
+ get :index
+ assert_response :redirect
+ assert_redirected_to login_path(:referer => issues_path)
+
+ # Access issues_path as normal user
+ session[:user] = users(:normal_user).id
+ get :index
+ assert_response :redirect
+ assert_redirected_to root_path
+
+ # Access issues_path by admin
+ session[:user] = users(:administrator_user).id
+ get :index
+ # this is redirected because there are no issues?!
+ assert_response :redirect
+ assert_redirected_to issues_path
+
+ # Access issues_path by moderator
+ session[:user] = users(:moderator_user).id
+ get :index
+ # this is redirected because there are no issues?!
+ assert_response :redirect
+ assert_redirected_to issues_path
+
+ # clear session
+ session.delete(:user)
+ end