You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/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)
Rails.application.routes.drawdoget'example/poc'# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.htmlget"test",to: "example#poc"localizeddoget"example/poc"endend
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
The text was updated successfully, but these errors were encountered:
I think this is due to the fact that name is like a "reserved" word, and route_translator is generating the localized helpers in the wrong place, tricking minitest.
Will update this comment
The problem is that using test, then the suite will call test method unexpectedly. You can see the tests growing up from 1 to 7
Steps to reproduce*
changing the route to
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)
Actual behavior*
The second test run fails when a route is defined starting with
test
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*
Route Translator initializier
Source of:
config/initializers/route_translator.rb
N/A
Source code of routes.rb*
Source of:
config/routes.rb
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
:Repository demostrating the issue
Running the script will demonstrate the issue
The text was updated successfully, but these errors were encountered: