From 1a48afd1f3bdbc7f70f404d5f3511e37fc658a65 Mon Sep 17 00:00:00 2001 From: Yuji Yaginuma Date: Fri, 27 Oct 2023 14:00:27 +0900 Subject: [PATCH] Remove the route that is defined by default Some test code loads the route file twice. This wasn't a problem before Rails 7.0 because we didn't have a route. But, Rails 7.1 has one route by default. So the test application raises the following error during the load. ``` Invalid route name, already in use: 'rails_health_check' (ArgumentError) You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: https://guides.rubyonrails.org/routing.html#restricting-the-routes-created ``` The routing isn't a matter of this gem, so just ignore that for running the test. --- features/support/rails_template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/support/rails_template b/features/support/rails_template index 6c21fc8..bc53016 100644 --- a/features/support/rails_template +++ b/features/support/rails_template @@ -10,4 +10,6 @@ if Rails.gem_version >= Gem::Version.new('7.1') config.autoload_lib(ignore: %w(some_railtie)) end RUBY + + gsub_file "config/routes.rb", /^ get/, ' # get' end