X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a09e3f3fe0097bb8fb9f1bc810f38f1539133d9b..f6141277d5a727fdec5c7bb26e35b17b1e6f495d:/test/controllers/issue_comments_controller_test.rb diff --git a/test/controllers/issue_comments_controller_test.rb b/test/controllers/issue_comments_controller_test.rb index 00c80f32c..823d07776 100644 --- a/test/controllers/issue_comments_controller_test.rb +++ b/test/controllers/issue_comments_controller_test.rb @@ -1,25 +1,24 @@ require "test_helper" -class IssueCommentsControllerTest < ActionController::TestCase +class IssueCommentsControllerTest < ActionDispatch::IntegrationTest def test_comment_by_normal_user issue = create(:issue) # Login as normal user - session[:user] = create(:user).id + session_for(create(:user)) - post :create, :params => { :issue_id => issue.id } - assert_response :redirect - assert_redirected_to root_path + post issue_comments_path(:issue_id => issue) + assert_redirected_to :controller => :errors, :action => :forbidden + assert_equal 0, issue.comments.length end def test_comment issue = create(:issue) # Login as administrator - session[:user] = create(:administrator_user).id + session_for(create(:administrator_user)) - post :create, :params => { :issue_id => issue.id, :issue_comment => { :body => "test comment" } } - assert_response :redirect + post issue_comments_path(:issue_id => issue, :issue_comment => { :body => "test comment" }) assert_redirected_to issue assert_equal 1, issue.comments.length end