3 class IssueCommentsControllerTest < ActionDispatch::IntegrationTest
4 def test_comment_by_normal_user
8 session_for(create(:user))
10 post issue_comments_path(:issue_id => issue)
11 assert_response :redirect
12 assert_redirected_to :controller => :errors, :action => :forbidden
13 assert_equal 0, issue.comments.length
17 issue = create(:issue)
19 # Login as administrator
20 session_for(create(:administrator_user))
22 post issue_comments_path(:issue_id => issue, :issue_comment => { :body => "test comment" })
23 assert_response :redirect
24 assert_redirected_to issue
25 assert_equal 1, issue.comments.length