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
16 issue = create(:issue)
18 # Login as administrator
19 session[:user] = create(:administrator_user).id
21 post :create, :params => { :issue_id => issue.id, :issue_comment => { :body => "test comment" } }
22 assert_response :redirect
23 assert_redirected_to issue
24 assert_equal 1, issue.comments.length