From f57c4a796b373c31f74ca614b832366023216e33 Mon Sep 17 00:00:00 2001
From: Takashi Kato <tohosaku@users.osdn.me>
Date: Thu, 15 Aug 2024 10:03:19 +0000
Subject: [PATCH 3/5] Fix for https://github.com/rails/rails/pull/51625

---
 config/environments/test.rb                                   | 2 ++
 test/helpers/application_helper_test.rb                       | 1 -
 test/helpers/avatars_helper_test.rb                           | 1 -
 test/helpers/groups_helper_test.rb                            | 1 -
 test/helpers/issues_helper_test.rb                            | 1 -
 test/helpers/members_helper_test.rb                           | 1 -
 test/helpers/projects_helper_test.rb                          | 1 -
 test/helpers/reports_helper_test.rb                           | 1 -
 test/helpers/routes_helper_test.rb                            | 2 --
 test/helpers/version_helper_test.rb                           | 1 -
 test/helpers/watchers_helper_test.rb                          | 1 -
 test/helpers/wiki_helper_test.rb                              | 1 -
 test/unit/lib/redmine/helpers/gantt_test.rb                   | 1 -
 test/unit/lib/redmine/menu_manager/menu_helper_test.rb        | 1 -
 test/unit/lib/redmine/views/labelled_form_builder_test.rb     | 1 -
 .../wiki_formatting/common_mark/application_helper_test.rb    | 1 -
 test/unit/lib/redmine/wiki_formatting/macros_test.rb          | 1 -
 test/unit/search_test.rb                                      | 4 ++++
 18 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/config/environments/test.rb b/config/environments/test.rb
index ea6080ac7..dc6239ca4 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -77,4 +77,6 @@ Rails.application.configure do
   # config.action_view.annotate_rendered_view_with_filenames = true
 
   config.secret_key_base = 'a secret token for running the tests'
+
+  config.active_support.assertionless_tests_behavior = :raise
 end
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index 8cb086f12..82991888d 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -21,7 +21,6 @@ require_relative '../test_helper'
 
 class ApplicationHelperTest < Redmine::HelperTest
   include ERB::Util
-  include Rails.application.routes.url_helpers
   include AvatarsHelper
 
   fixtures :projects, :enabled_modules,
diff --git a/test/helpers/avatars_helper_test.rb b/test/helpers/avatars_helper_test.rb
index 06c4d5993..d9d87dd10 100644
--- a/test/helpers/avatars_helper_test.rb
+++ b/test/helpers/avatars_helper_test.rb
@@ -21,7 +21,6 @@ require_relative '../test_helper'
 
 class AvatarsHelperTest < Redmine::HelperTest
   include ERB::Util
-  include Rails.application.routes.url_helpers
   include AvatarsHelper
 
   fixtures :users, :email_addresses
diff --git a/test/helpers/groups_helper_test.rb b/test/helpers/groups_helper_test.rb
index 6162388a8..66abc9808 100644
--- a/test/helpers/groups_helper_test.rb
+++ b/test/helpers/groups_helper_test.rb
@@ -23,7 +23,6 @@ class GroupsHelperTest < Redmine::HelperTest
   include ERB::Util
   include GroupsHelper
   include AvatarsHelper
-  include Rails.application.routes.url_helpers
 
   fixtures :users
 
diff --git a/test/helpers/issues_helper_test.rb b/test/helpers/issues_helper_test.rb
index c91c47c4a..fd469b986 100644
--- a/test/helpers/issues_helper_test.rb
+++ b/test/helpers/issues_helper_test.rb
@@ -23,7 +23,6 @@ class IssuesHelperTest < Redmine::HelperTest
   include IssuesHelper
   include CustomFieldsHelper
   include ERB::Util
-  include Rails.application.routes.url_helpers
 
   fixtures :projects, :trackers, :issue_statuses, :issues,
            :enumerations, :users, :issue_categories,
diff --git a/test/helpers/members_helper_test.rb b/test/helpers/members_helper_test.rb
index bae1b58ba..a3120711c 100644
--- a/test/helpers/members_helper_test.rb
+++ b/test/helpers/members_helper_test.rb
@@ -23,7 +23,6 @@ class MembersHelperTest < Redmine::HelperTest
   include ERB::Util
   include MembersHelper
   include AvatarsHelper
-  include Rails.application.routes.url_helpers
 
   fixtures :projects, :users, :members, :member_roles,
            :trackers, :issue_statuses
diff --git a/test/helpers/projects_helper_test.rb b/test/helpers/projects_helper_test.rb
index b3ca95e95..dc6438bc3 100644
--- a/test/helpers/projects_helper_test.rb
+++ b/test/helpers/projects_helper_test.rb
@@ -22,7 +22,6 @@ require_relative '../test_helper'
 class ProjectsHelperTest < Redmine::HelperTest
   include ProjectsHelper
   include ERB::Util
-  include Rails.application.routes.url_helpers
 
   fixtures :projects, :trackers, :issue_statuses, :issues,
            :enumerations, :users, :issue_categories,
diff --git a/test/helpers/reports_helper_test.rb b/test/helpers/reports_helper_test.rb
index 88a7aad56..9b3ac8a26 100644
--- a/test/helpers/reports_helper_test.rb
+++ b/test/helpers/reports_helper_test.rb
@@ -21,7 +21,6 @@ require_relative '../test_helper'
 
 class ReportsHlperTest < Redmine::HelperTest
   include ReportsHelper
-  include Rails.application.routes.url_helpers
 
   fixtures :projects, :users
 
diff --git a/test/helpers/routes_helper_test.rb b/test/helpers/routes_helper_test.rb
index 4a2427c13..6bca90cf8 100644
--- a/test/helpers/routes_helper_test.rb
+++ b/test/helpers/routes_helper_test.rb
@@ -22,8 +22,6 @@ require_relative '../test_helper'
 class RoutesHelperTest < Redmine::HelperTest
   fixtures :projects, :issues
 
-  include Rails.application.routes.url_helpers
-
   def test_time_entries_path
     assert_equal '/projects/ecookbook/time_entries', _time_entries_path(Project.find(1), nil)
     assert_equal '/time_entries', _time_entries_path(nil, nil)
diff --git a/test/helpers/version_helper_test.rb b/test/helpers/version_helper_test.rb
index bb083a4e0..19243518e 100644
--- a/test/helpers/version_helper_test.rb
+++ b/test/helpers/version_helper_test.rb
@@ -20,7 +20,6 @@
 require_relative '../test_helper'
 
 class VersionsHelperTest < Redmine::HelperTest
-  include Rails.application.routes.url_helpers
 
   fixtures :projects, :versions, :enabled_modules,
            :users, :members, :roles, :member_roles,
diff --git a/test/helpers/watchers_helper_test.rb b/test/helpers/watchers_helper_test.rb
index 6375c565e..cc413f8fa 100644
--- a/test/helpers/watchers_helper_test.rb
+++ b/test/helpers/watchers_helper_test.rb
@@ -23,7 +23,6 @@ class WatchersHelperTest < Redmine::HelperTest
   include WatchersHelper
   include AvatarsHelper
   include ERB::Util
-  include Rails.application.routes.url_helpers
 
   fixtures :users, :issues
 
diff --git a/test/helpers/wiki_helper_test.rb b/test/helpers/wiki_helper_test.rb
index dfae80b0b..eda1bfe1a 100644
--- a/test/helpers/wiki_helper_test.rb
+++ b/test/helpers/wiki_helper_test.rb
@@ -21,7 +21,6 @@ require_relative '../test_helper'
 
 class WikiHelperTest < Redmine::HelperTest
   include WikiHelper
-  include Rails.application.routes.url_helpers
 
   fixtures :projects, :users,
            :roles, :member_roles, :members,
diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb
index 25aebbcaf..d485518a3 100644
--- a/test/unit/lib/redmine/helpers/gantt_test.rb
+++ b/test/unit/lib/redmine/helpers/gantt_test.rb
@@ -29,7 +29,6 @@ class Redmine::Helpers::GanttHelperTest < Redmine::HelperTest
   include AvatarsHelper
 
   include ERB::Util
-  include Rails.application.routes.url_helpers
 
   def setup
     setup_with_controller
diff --git a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
index 6cdc4b11e..3d9570182 100644
--- a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
+++ b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
@@ -22,7 +22,6 @@ require_relative '../../../../test_helper'
 class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
   include Redmine::MenuManager::MenuHelper
   include ERB::Util
-  include Rails.application.routes.url_helpers
 
   fixtures :users, :members, :projects, :enabled_modules, :roles, :member_roles
 
diff --git a/test/unit/lib/redmine/views/labelled_form_builder_test.rb b/test/unit/lib/redmine/views/labelled_form_builder_test.rb
index e7701c4bc..27ab456ff 100644
--- a/test/unit/lib/redmine/views/labelled_form_builder_test.rb
+++ b/test/unit/lib/redmine/views/labelled_form_builder_test.rb
@@ -20,7 +20,6 @@
 require_relative '../../../../test_helper'
 
 class Redmine::Views::LabelledFormBuilderTest < Redmine::HelperTest
-  include Rails.application.routes.url_helpers
 
   def test_label_should_output_one_element
     set_language_if_valid 'en'
diff --git a/test/unit/lib/redmine/wiki_formatting/common_mark/application_helper_test.rb b/test/unit/lib/redmine/wiki_formatting/common_mark/application_helper_test.rb
index c198f64cd..7b5915f7d 100644
--- a/test/unit/lib/redmine/wiki_formatting/common_mark/application_helper_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/common_mark/application_helper_test.rb
@@ -23,7 +23,6 @@ class Redmine::WikiFormatting::CommonMark::ApplicationHelperTest < Redmine::Help
   if Object.const_defined?(:CommonMarker)
 
     include ERB::Util
-    include Rails.application.routes.url_helpers
 
     fixtures :projects, :enabled_modules,
              :users, :email_addresses,
diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
index 1355acef3..ffc28870d 100644
--- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
@@ -23,7 +23,6 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
   include ActionView::Helpers::TextHelper
   include ActionView::Helpers::SanitizeHelper
   include ERB::Util
-  include Rails.application.routes.url_helpers
   extend ActionView::Helpers::SanitizeHelper::ClassMethods
 
   fixtures :projects, :roles, :enabled_modules, :users,
diff --git a/test/unit/search_test.rb b/test/unit/search_test.rb
index 6620f6a83..d4f2f5f99 100644
--- a/test/unit/search_test.rb
+++ b/test/unit/search_test.rb
@@ -181,6 +181,8 @@ class SearchTest < ActiveSupport::TestCase
       r = Issue.search_results('ÖÖ')
       assert_include issue1, r
       assert_include issue2, r
+    else
+      skip
     end
   end
 
@@ -191,6 +193,8 @@ class SearchTest < ActiveSupport::TestCase
       r = Issue.search_results('ÖÖ')
       assert_include issue1, r
       assert_include issue2, r
+    else
+      skip
     end
   end
 
-- 
2.39.2

