]> git.openstreetmap.org Git - rails.git/blob - test/controllers/issue_comments_controller_test.rb
Bump leaflet.locatecontrol from 0.73.0 to 0.74.0
[rails.git] / test / controllers / issue_comments_controller_test.rb
1 require "test_helper"
2
3 class IssueCommentsControllerTest < ActionDispatch::IntegrationTest
4   def test_comment_by_normal_user
5     issue = create(:issue)
6
7     # Login as normal user
8     session_for(create(:user))
9
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
14   end
15
16   def test_comment
17     issue = create(:issue)
18
19     # Login as administrator
20     session_for(create(:administrator_user))
21
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
26   end
27 end