diff options
author | Yasyf Mohamedali <yasyfm@gmail.com> | 2015-02-24 16:04:27 -0500 |
---|---|---|
committer | Yasyf Mohamedali <yasyfm@gmail.com> | 2015-02-24 16:04:27 -0500 |
commit | 6c14252d2cc28b97ba708971a3ad235537bcdf02 (patch) | |
tree | 9b5e4be9628b3f20715fe9fd97443c170cc6f77e /actionpack/test/controller | |
parent | 2bc72ae29c660a2d9bf6b1b42db4fe18f0d1492f (diff) | |
download | rails-6c14252d2cc28b97ba708971a3ad235537bcdf02.tar.gz rails-6c14252d2cc28b97ba708971a3ad235537bcdf02.tar.bz2 rails-6c14252d2cc28b97ba708971a3ad235537bcdf02.zip |
Fallback to RAILS_RELATIVE_URL_ROOT in `url_for`.
Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment
variable is not prepended to the path when `url_for` is called.
If `SCRIPT_NAME` (used by Rack) is set, it takes precedence.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/url_for_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/url_for_test.rb b/actionpack/test/controller/url_for_test.rb index 0ffa2d2a03..cd63493b32 100644 --- a/actionpack/test/controller/url_for_test.rb +++ b/actionpack/test/controller/url_for_test.rb @@ -255,6 +255,16 @@ module AbstractController ) end + def test_relative_url_root_is_respected_with_environment_variable + # `config.relative_url_root` is set by ENV['RAILS_RELATIVE_URL_ROOT'] + ActionDispatch::Routing::RouteSet.relative_url_root = '/subdir' + add_host! + assert_equal('https://www.basecamphq.com/subdir/c/a/i', + W.new.url_for(:controller => 'c', :action => 'a', :id => 'i', :protocol => 'https') + ) + ActionDispatch::Routing::RouteSet.relative_url_root = nil + end + def test_named_routes with_routing do |set| set.draw do |