From 798a14a6388ac525109e550d72bba0b1118e5e2e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 5 Mar 2015 13:11:53 -0800 Subject: pass a config to the route set This way we can get the relative_url_root from the application without setting another global value --- railties/test/application/url_generation_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'railties/test/application') diff --git a/railties/test/application/url_generation_test.rb b/railties/test/application/url_generation_test.rb index ef16ab56ed..894e18cb39 100644 --- a/railties/test/application/url_generation_test.rb +++ b/railties/test/application/url_generation_test.rb @@ -42,5 +42,18 @@ module ApplicationTests get "/" assert_equal "/", last_response.body end + + def test_routes_know_the_relative_root + boot_rails + require "rails" + require "action_controller/railtie" + require "action_view/railtie" + + relative_url = '/hello' + ENV["RAILS_RELATIVE_URL_ROOT"] = relative_url + app = Class.new(Rails::Application) + assert_equal relative_url, app.routes.relative_url_root + ENV["RAILS_RELATIVE_URL_ROOT"] = nil + end end end -- cgit v1.2.3