From ef4c3c4b475dff4518575249aa094ba240dece66 Mon Sep 17 00:00:00 2001 From: Ryunosuke Sato Date: Wed, 18 Nov 2026 01:39:52 +0900 Subject: [PATCH 1/2] Draw the routes before the specs run Rails 8.0+ puts off drawing the routes until a request first needs them, so the example that makes the suite's first request draws them under its own stubs. When that example is the one in `mount_point_spec.rb`, which replaces the application's deploy with a double, `mount_ember_app` fails on `mountable?`, and on Rails 8.0 the half-drawn routes then fail every later example that needs them. The suite runs in random order, so only some CI jobs hit this. Draw the routes while the suite loads, as earlier versions of Rails do while initializing. Co-Authored-By: Claude Mythos 5.2 --- spec/spec_helper.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c2c372b2..6af08be8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,13 @@ Dummy::Application.initialize! +# Rails 8.0+ puts off drawing the routes until a request first needs them, so +# whichever example makes the suite's first request would draw them under its +# own stubs: `mount_ember_app` asks the application whether its deploy is +# mountable, which a stubbed deploy cannot answer. Draw them up front, as +# earlier versions of Rails do while initializing. +Rails.application.try(:reload_routes_unless_loaded) + Dir["spec/support/**/*.rb"].sort.each { |file| require "./#{file}" } RSpec.configure do |config| From 2f71566f7ff0af19ed9816300f134507c734b358 Mon Sep 17 00:00:00 2001 From: Ryunosuke Sato Date: Wed, 18 Nov 2026 01:47:13 +0900 Subject: [PATCH 2/2] Ask the application whether it can draw routes lazily `Object#try` hid that the call is skipped on Rails 7.2, which does not define `reload_routes_unless_loaded`. Say so with `respond_to?`. Co-Authored-By: Claude Mythos 5.2 --- spec/spec_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6af08be8..198120ee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,7 +14,9 @@ # own stubs: `mount_ember_app` asks the application whether its deploy is # mountable, which a stubbed deploy cannot answer. Draw them up front, as # earlier versions of Rails do while initializing. -Rails.application.try(:reload_routes_unless_loaded) +if Rails.application.respond_to?(:reload_routes_unless_loaded) + Rails.application.reload_routes_unless_loaded +end Dir["spec/support/**/*.rb"].sort.each { |file| require "./#{file}" }