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_redirected_to :controller => :errors, :action => :forbidden
12 assert_equal 0, issue.comments.length
16 issue = create(:issue)
18 # Login as administrator
19 session_for(create(:administrator_user))
21 post issue_comments_path(:issue_id => issue, :issue_comment => { :body => "test comment" })
22 assert_redirected_to issue
23 assert_equal 1, issue.comments.length