From 922f817a5a369adc8cb0dd53f332785ee20a667a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 13 Dec 2004 11:35:48 +0000 Subject: Added the option of passing false to :module or :controller_prefix in order to "break out" of a module or prefix git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@142 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/url_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/url_test.rb b/actionpack/test/controller/url_test.rb index bf6a7aab75..10577382a6 100644 --- a/actionpack/test/controller/url_test.rb +++ b/actionpack/test/controller/url_test.rb @@ -22,6 +22,14 @@ class UrlTest < Test::Unit::TestCase { "type" => "ISBN", "code" => "0743536703" } ), "books", "show") + @library_url_using_module = ActionController::UrlRewriter.new(MockRequest.new( + "http://", + "www.singlefile.com", + 80, + "/library/books/ISBN/0743536703/show", + { "type" => "ISBN", "code" => "0743536703", "module" => "library" } + ), "books", "show") + @library_url_on_index = ActionController::UrlRewriter.new(MockRequest.new( "http://", "www.singlefile.com", @@ -102,6 +110,10 @@ class UrlTest < Test::Unit::TestCase def test_clean_controller_with_module assert_equal "http://www.singlefile.com/shop/purchases/", @library_url.rewrite(:module => "shop", :controller => "purchases") end + + def test_getting_out_of_a_module + assert_equal "http://www.singlefile.com/purchases/", @library_url_using_module.rewrite(:module => false, :controller => "purchases") + end def test_controller_and_action assert_equal "http://www.singlefile.com/library/settings/show", @library_url.rewrite(:controller => "settings", :action => "show") -- cgit v1.2.3