This project is archived and is in readonly mode.
Functional tests cannot add a route
-
Santiago Pastorino
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
-
Murray Steele
- State changed from stale to open
[state:open]
It's certainly still a problem as routes are cleared if we redraw them in our tests and sometimes we want the new route and our application routes. Not sure what the solution is, but I got around it as follows:
def setup routes = Rails.application.routes routes.disable_clear_and_finalize = true routes.clear! Rails.application.routes_reloader.paths.each { |path| load(path) } routes.draw do match "/test-action" => "my_controller_test/test#index" end routes.disable_clear_and_finalize = false routes.finalize! end def teardown Rails.application.reload_routes! endBut this is clearly upsetting. Perhaps the with_routing helper from ActionDispatch::Assertions::RoutingAssertions could be updated to work in 2 ways. The default is to work as it does now, where the routes defined in the block are the only available ones. The 2nd mode (or new helper) would provide routing that keeps the existing app routes around and adds those in the block to them. Both modes should reset back to the default app routes at the end of the block.