]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/reports_controller_test.rb
Merge remote-tracking branch 'upstream/pull/4827'
[rails.git] / test / controllers / reports_controller_test.rb
index e8f59ec5ec1df1ed270c4f4e47607520a0300060..25b80e8f4bb418e9231088921b5fa2d08ae66836 100644 (file)
@@ -4,7 +4,6 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
   def test_new_report_without_login
     target_user = create(:user)
     get new_report_path(:reportable_id => target_user.id, :reportable_type => "User")
-    assert_response :redirect
     assert_redirected_to login_path(:referer => new_report_path(:reportable_id => target_user.id, :reportable_type => "User"))
   end
 
@@ -25,7 +24,6 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
                           :issue => { :reportable_id => target_user.id, :reportable_type => "User" }
                         })
     end
-    assert_response :redirect
     assert_redirected_to user_path(target_user)
   end
 
@@ -48,7 +46,6 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
                           :issue => { :reportable_id => target_user.id, :reportable_type => "User" }
                         })
     end
-    assert_response :redirect
     assert_redirected_to user_path(target_user)
 
     issue = Issue.last
@@ -63,10 +60,12 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
       category = "other"
       post reports_path(:report => {
                           :category => category,
-                          :issue => { :reportable_id => 1, :reportable_type => "User" }
+                          :issue => { :reportable_id => target_user.id, :reportable_type => "User" }
                         })
     end
-    assert_response :redirect
+    assert_response :success
+    assert_template :new
+    assert_match(/Please provide the required details/, flash[:notice])
 
     assert_equal 1, issue.reports.count
   end
@@ -90,7 +89,6 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
                           :issue => { :reportable_id => target_user.id, :reportable_type => "User" }
                         })
     end
-    assert_response :redirect
     assert_redirected_to user_path(target_user)
 
     issue = Issue.last