]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/3542'
authorTom Hughes <tom@compton.nu>
Wed, 4 May 2022 19:27:20 +0000 (20:27 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 4 May 2022 19:27:20 +0000 (20:27 +0100)
app/controllers/reports_controller.rb
test/controllers/reports_controller_test.rb

index a04fab5b9ab36c87a19a442c07b277cc59c56250..30cb9da7cc18c526ab9b93eabbb338cf72fbf2a8 100644 (file)
@@ -28,7 +28,8 @@ class ReportsController < ApplicationController
 
       redirect_to helpers.reportable_url(@report.issue.reportable), :notice => t(".successful_report")
     else
-      redirect_to new_report_path(:reportable_type => @report.issue.reportable_type, :reportable_id => @report.issue.reportable_id), :notice => t(".provide_details")
+      flash[:notice] = t(".provide_details")
+      render :action => "new"
     end
   end
 
index e8f59ec5ec1df1ed270c4f4e47607520a0300060..8374e76d9f5d0efefe9fe39239cb8d7d8e4fbeeb 100644 (file)
@@ -63,10 +63,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