-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
Description
Hi,
I'm using route_translator
v5.5.0 gem and running the following issue. I hope someone can clarify why it's behaving this way.
#app/config/routes.rb
App::Engine.routes.draw do
#This is to hide the extra translation /:locale/engine/:locale/path
RouteTranslator.config { |config| config.hide_locale = true }
localized do
root to: "pages#index"
end
end
#app/spec/dummy_app/config/routes.rb
Rails.application.routes.draw do
localized do
mount App::Engine => "/app"
end
end
#spec/dummy_app/config/application.rb
module DummyApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
I18n.available_locales = [:en, :de]
I18n.default_locale = :en
end
end
Prefix Verb URI Pattern Controller#Action
app_de /de/app App::Engine {:locale=>"de"}
app_en /app App::Engine {:locale=>"en"}
Routes for App::Engine:
root_de GET / app/pages#landing {:locale=>"de"}
root_en GET / app/pages#landing {:locale=>"en"}
#spec/routing/app_engine_routes_spec.rb
describe 'routes for App engine' do
routes { App::Engine.routes }
it 'routes / to the index page' do
expect(get: '/').to route_to(
controller: "app/pages",
action: "index",
locale: 'en',
)
end
end
Since I set my default_locale, I would expect it returns en
, but it returns de
as locale instead. Any idea how to do proper spec in this scenario?