Skip to content

Commit ed43a23

Browse files
committed
Fix Devise mapping not found error in Rails 8
This fixes a Devise mapping error on system tests. ``` E Error: AdminUsersTest#test_visiting_the_edit: RuntimeError: Could not find a valid mapping for #<AdminUser id: 1, email: [FILTERED], created_at: "2025-09-25 21:07:53.971537000 +0000", updated_at: "2025-09-25 21:07:53.971537000 +0000"> test/system/active_admin/admin_users_test.rb:42:in 'block in <class:AdminUsersTest>' bin/rails test test/system/active_admin/admin_users_test.rb:41 ```
1 parent d500246 commit ed43a23

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/application_system_test_case.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44

55
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
66
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
7+
8+
def setup
9+
# Fix Devise mapping not found error in Rails 8 when running these spec types directly
10+
# https://github.com/heartcombo/devise/issues/5774#issuecomment-2944728967
11+
Rails.application.try(:reload_routes_unless_loaded)
12+
end
713
end

0 commit comments

Comments
 (0)