aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorKamil Sobieraj <ksobej@gmail.com>2011-10-04 09:16:34 +0100
committerKamil Sobieraj <ksobej@gmail.com>2011-10-04 09:16:34 +0100
commitde942e5534a26942e261a7699adc28597c5ad1bc (patch)
treec326ef6b47d71a763d7a635c5496dd99739af1c1 /actionpack/test/controller
parent1eac9119620e9b537c1eca9619d4fa3ecb546149 (diff)
downloadrails-de942e5534a26942e261a7699adc28597c5ad1bc.tar.gz
rails-de942e5534a26942e261a7699adc28597c5ad1bc.tar.bz2
rails-de942e5534a26942e261a7699adc28597c5ad1bc.zip
:subdomain can now be specified with a value of false in url_for, allowing for subdomain(s) removal from the host during link generation. Closes #2025
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/url_for_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/url_for_test.rb b/actionpack/test/controller/url_for_test.rb
index 484e996f31..11ced2df2a 100644
--- a/actionpack/test/controller/url_for_test.rb
+++ b/actionpack/test/controller/url_for_test.rb
@@ -67,6 +67,20 @@ module AbstractController
)
end
+ def test_subdomain_may_be_removed
+ add_host!
+ assert_equal('http://basecamphq.com/c/a/i',
+ W.new.url_for(:subdomain => false, :controller => 'c', :action => 'a', :id => 'i')
+ )
+ end
+
+ def test_multiple_subdomains_may_be_removed
+ W.default_url_options[:host] = 'mobile.www.api.basecamphq.com'
+ assert_equal('http://basecamphq.com/c/a/i',
+ W.new.url_for(:subdomain => false, :controller => 'c', :action => 'a', :id => 'i')
+ )
+ end
+
def test_domain_may_be_changed
add_host!
assert_equal('http://www.37signals.com/c/a/i',