aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-27 05:36:03 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-27 05:36:03 +0000
commit2269c23699968d31f2f81052ebcf7fcc29e82502 (patch)
tree68b5cb806b3b6f227fb04c0182a4feee1e04a1aa /actionpack/test/controller
parentde1f231c32155c10e4b03c3b861a885786dc9f59 (diff)
downloadrails-2269c23699968d31f2f81052ebcf7fcc29e82502.tar.gz
rails-2269c23699968d31f2f81052ebcf7fcc29e82502.tar.bz2
rails-2269c23699968d31f2f81052ebcf7fcc29e82502.zip
Fixed assert_redirected_to to handle absolute controller paths properly #1472 [Rick Olson/Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index 4ecf6b6b5b..2cf9c72f45 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -79,7 +79,17 @@ class ActionPackAssertionsController < ActionController::Base
# 911
def rescue_action(e) raise; end
-
+end
+
+module Admin
+ class InnerModuleController < ActionController::Base
+ def redirect_to_absolute_controller
+ redirect_to :controller => '/content'
+ end
+ def redirect_to_fellow_controller
+ redirect_to :controller => 'user'
+ end
+ end
end
# ---------------------------------------------------------------------------
@@ -392,6 +402,15 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
process :redirect_to_path
assert_redirected_to 'http://test.host/some/path'
end
+
+ def test_redirected_to_with_nested_controller
+ @controller = Admin::InnerModuleController.new
+ get :redirect_to_absolute_controller
+ assert_redirected_to :controller => 'content'
+
+ get :redirect_to_fellow_controller
+ assert_redirected_to :controller => 'admin/user'
+ end
end
class ActionPackHeaderTest < Test::Unit::TestCase
@@ -404,8 +423,8 @@ class ActionPackHeaderTest < Test::Unit::TestCase
assert_equal('text/xml', @controller.headers['Content-Type'])
end
def test_rendering_xml_respects_content_type
- @response.headers['Content-Type'] = 'application/pdf'
- process :hello_xml_world
- assert_equal('application/pdf', @controller.headers['Content-Type'])
+ @response.headers['Content-Type'] = 'application/pdf'
+ process :hello_xml_world
+ assert_equal('application/pdf', @controller.headers['Content-Type'])
end
end