+ def test_reopen
+ target_user = create(:user)
+ issue = create(:issue, :reportable => target_user, :reported_user => target_user)
+
+ issue.resolve!
+
+ # Reopen issue without login
+ get :reopen, :params => { :id => issue.id }
+ assert_response :redirect
+ assert_redirected_to login_path(:referer => reopen_issue_path(issue))
+
+ # Reopen issue as normal user
+ session[:user] = create(:user).id
+ get :reopen, :params => { :id => issue.id }
+ assert_response :redirect
+ assert_redirected_to root_path
+
+ # Reopen issue as administrator
+ session[:user] = create(:administrator_user).id
+ get :reopen, :params => { :id => issue.id }
+ assert_response :redirect
+ assert_equal true, issue.reload.open?
+
+ issue.resolve!
+
+ # Reopen issue as moderator
+ session[:user] = create(:moderator_user).id
+ get :reopen, :params => { :id => issue.id }
+ assert_response :redirect
+ assert_equal true, issue.reload.open?
+ end