]> git.openstreetmap.org Git - rails.git/blob - test/controllers/issue_comments_controller_test.rb
Use options_for_select to set the selected items in the search form
[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   end
14
15   def test_comment
16     issue = create(:issue)
17
18     # Login as administrator
19     session[:user] = create(:administrator_user).id
20
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
25   end
26 end