From 80b656637a29ce827b10923bb357cd56cde9b15f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 24 Jan 2005 13:50:58 +0000 Subject: Added :application_prefix to url_for and friends that makes it easier to setup Rails in non-vhost environments #516 [Jamis Buck] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@494 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/url_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/url_test.rb b/actionpack/test/controller/url_test.rb index 8315830776..f7f08a2fe5 100644 --- a/actionpack/test/controller/url_test.rb +++ b/actionpack/test/controller/url_test.rb @@ -453,4 +453,25 @@ class UrlTest < Test::Unit::TestCase url.rewrite({ :controller => "msg", :action_prefix => "allous", :action => "new" }) ) end + + def test_clean_application_prefix + assert_equal "http://www.singlefile.com/namespace/library/books/ISBN/0743536703/show", + @library_url.rewrite(:application_prefix => "/namespace") + end + + def test_clean_application_prefix_with_controller_prefix + assert_equal "http://www.singlefile.com/namespace/shop/", + @library_url.rewrite(:application_prefix => "/namespace", + :controller_prefix => "shop" ) + end + + def test_blank_application_prefix + assert_equal "http://www.singlefile.com/library/books/ISBN/0743536703/show", + @library_url.rewrite(:application_prefix => "") + end + + def test_nil_application_prefix + assert_equal "http://www.singlefile.com/library/books/ISBN/0743536703/show", + @library_url.rewrite(:application_prefix => nil) + end end -- cgit v1.2.3