]> git.openstreetmap.org Git - rails.git/blob - test/controllers/issue_comments_controller_test.rb
Use sshfs in preference to nfs for vagrant file sharing
[rails.git] / test / controllers / issue_comments_controller_test.rb
1 require "test_helper"
2
3 class IssueCommentsControllerTest < ActionController::TestCase
4   def test_comment_by_normal_user
5     issue = create(:issue)
6
7     # Login as normal user
8     session[:user] = create(:user).id
9
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
14   end
15
16   def test_comment
17     issue = create(:issue)
18
19     # Login as administrator
20     session[:user] = create(:administrator_user).id
21
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
26   end
27 end