-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
Description
Steps to reproduce*
#!/bin/bash
set -euo pipefail
shopt -s inherit_errexit
rails new bug_poc
cd bug_poc
echo "gem 'route_translator'" >> Gemfile
bundler
rails g controller example poc
rails db:migrate
rails test # Tests run fine here
sed -i '4i\
get "test", to: "example#poc"\
localized do\
get "example/poc"\
end' config/routes.rb
rails test # Tests will break now
changing the route to
get "testing", to: "example#poc"\ #Or anything else than `test`
causes the test to succeed again
Expected behavior*
I expect the two test runs to be identical (the localization of the existing route is not tested)
...
Finished in 2.162236s, 0.4625 runs/s, 0.4625 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
...
Finished in 2.162236s, 0.4625 runs/s, 0.4625 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
...
Actual behavior*
The second test run fails when a route is defined starting with test
...
Finished in 2.162236s, 0.4625 runs/s, 0.4625 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
...
Finished in 0.122703s, 57.0481 runs/s, 8.1497 assertions/s.
7 runs, 1 assertions, 0 failures, 4 errors, 0 skips
...
System configuration*
Rails version:
Rails 6.0.3.2
Ruby version:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
Route Translator version:
route_translator (8.0.0)
I18n configuration*
# Replace this comment with your I18n configuration
# taken from config/application.rb
Route Translator initializier
Source of: config/initializers/route_translator.rb
N/A
Source code of routes.rb*
Source of: config/routes.rb
Rails.application.routes.draw do
get 'example/poc'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
get "test", to: "example#poc"
localized do
get "example/poc"
end
end
Locale .yml
files*
Source of config/locales/xx.yml
N/A
Source of config/locales/yy.yml
N/A
Output of rails routes
*
Result of bundle exec rails routes
:
Prefix Verb URI Pattern Controller#Action
example_poc GET /example/poc(.:format) example#poc
test GET /test(.:format) example#poc
GET /example/poc(.:format) example#poc {:locale=>"en"}
rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create
rails_relay_inbound_emails POST /rails/action_mailbox/relay/inbound_emails(.:format) action_mailbox/ingresses/relay/inbound_emails#create
rails_sendgrid_inbound_emails POST /rails/action_mailbox/sendgrid/inbound_emails(.:format) action_mailbox/ingresses/sendgrid/inbound_emails#create
rails_mandrill_inbound_health_check GET /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#health_check
rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create
rails_mailgun_inbound_emails POST /rails/action_mailbox/mailgun/inbound_emails/mime(.:format) action_mailbox/ingresses/mailgun/inbound_emails#create
rails_conductor_inbound_emails GET /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#index
POST /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#create
new_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/new(.:format) rails/conductor/action_mailbox/inbound_emails#new
edit_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id/edit(.:format) rails/conductor/action_mailbox/inbound_emails#edit
rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show
PATCH /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update
PUT /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update
DELETE /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#destroy
rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create
rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show
rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show
rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show
update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
Repository demostrating the issue
Running the script will demonstrate the issue