]> git.openstreetmap.org Git - rails.git/blob - test/controllers/issue_comments_controller_test.rb
Merge pull request #5406 from AntonKhorev/offline-message-oauth
[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_redirected_to :controller => :errors, :action => :forbidden
12     assert_equal 0, issue.comments.length
13   end
14
15   def test_comment
16     issue = create(:issue)
17
18     # Login as administrator
19     session_for(create(:administrator_user))
20
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
24   end
25 end