3 class IssueCommentsControllerTest < ActionController::TestCase
4 def test_comment_by_normal_user
8 session[:user] = create(:user).id
10 post :create, :params => { :issue_id => issue.id }
11 assert_response :redirect
12 assert_redirected_to root_path
13 assert_equal 0, issue.comments.length
17 issue = create(:issue)
19 # Login as administrator
20 session[:user] = create(:administrator_user).id
22 post :create, :params => { :issue_id => issue.id, :issue_comment => { :body => "test comment" } }
23 assert_response :redirect
24 assert_redirected_to issue
25 assert_equal 1, issue.comments.length