]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/issues_controller_test.rb
Use rails 5 version of redirect_back.
[rails.git] / test / controllers / issues_controller_test.rb
index 602c6eb53c135dc3ea0cdd148035a5337560f21a..161fd6d4c7cf6b7c33b5e98c0682ab5250df3364 100644 (file)
@@ -104,7 +104,7 @@ class IssuesControllerTest < ActionController::TestCase
            }
     end
     assert_response :redirect
-    assert_equal Issue.find_by_reportable_id_and_reportable_type(target_user.id, "User").reports.count, 1
+    assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count, 1
 
     # Report without details
     assert_no_difference "Issue.count" do
@@ -115,7 +115,7 @@ class IssuesControllerTest < ActionController::TestCase
            }
     end
     assert_response :redirect
-    assert_equal Issue.find_by_reportable_id_and_reportable_type(target_user.id, "User").reports.count, 1
+    assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count, 1
   end
 
   def test_new_report_with_complete_details
@@ -156,7 +156,7 @@ class IssuesControllerTest < ActionController::TestCase
            }
     end
     assert_response :redirect
-    report_count = Issue.find_by_reportable_id_and_reportable_type(target_user.id, "User").reports.count
+    report_count = Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count
     assert_equal report_count, 2
   end
 
@@ -184,17 +184,17 @@ class IssuesControllerTest < ActionController::TestCase
 
     # Test 'Resolved'
     get :resolve, :params => { :id => issue.id }
-    assert_equal Issue.find_by_reportable_id_and_reportable_type(target_user.id, "User").resolved?, true
+    assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").resolved?, true
     assert_response :redirect
 
     # Test 'Reopen'
     get :reopen, :params => { :id => issue.id }
-    assert_equal Issue.find_by_reportable_id_and_reportable_type(target_user.id, "User").open?, true
+    assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").open?, true
     assert_response :redirect
 
     # Test 'Ignored'
     get :ignore, :params => { :id => issue.id }
-    assert_equal Issue.find_by_reportable_id_and_reportable_type(target_user, "User").ignored?, true
+    assert_equal Issue.find_by(:reportable_id => target_user, :reportable_type => "User").ignored?, true
     assert_response :redirect
   end