Changeset 1609
- Timestamp:
- 07/02/05 18:16:38 (3 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/assertions.rb (modified) (1 diff)
- trunk/actionpack/test/controller/redirect_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r1606 r1609 11 11 xml.cdata! "some text" # => <![CDATA[some text]]> 12 12 13 * Added evaluation of <SCRIPT> blocks in content returned to Ajax calls #1577 [Thomas Fuchs/court3nay ]13 * Added evaluation of <SCRIPT> blocks in content returned to Ajax calls #1577 [Thomas Fuchs/court3nay/Sean Treadway] 14 14 15 15 * Directly generate paths with a leading slash instead of tacking it on later. #1543 [Nicholas Seckar] trunk/actionpack/lib/action_controller/assertions.rb
r1557 r1609 57 57 # redirect_to(:controller => "weblog", :action => "show") and so on. 58 58 def assert_redirected_to(options = {}, message=nil) 59 assert_re direct(message)59 assert_response(:redirect, message) 60 60 61 61 if options.is_a?(String) 62 62 msg = build_message(message, "expected a redirect to <?>, found one to <?>", options, @response.redirect_url) 63 64 63 url_regexp = %r{^(\w+://.*?(/|$|\?))(.*)$} 65 64 eurl, epath, url, path = [options, @response.redirect_url].collect do |url| trunk/actionpack/test/controller/redirect_test.rb
r1251 r1609 12 12 def host_redirect 13 13 redirect_to :action => "other_host", :only_path => false, :host => 'other.test.host' 14 end 15 16 def module_redirect 17 redirect_to :controller => 'module_test/module_redirect', :action => "hello_world" 14 18 end 15 19 … … 43 47 assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host' 44 48 end 49 50 def test_module_redirect 51 get :module_redirect 52 assert_redirect_url "http://test.host/module_test/module_redirect/hello_world" 53 end 54 55 def test_module_redirect_using_options 56 get :module_redirect 57 assert_redirected_to :controller => 'module_test/module_redirect', :action => 'hello_world' 58 end 45 59 end 60 61 module ModuleTest 62 class ModuleRedirectController < ::RedirectController 63 def module_redirect 64 redirect_to :controller => '/redirect', :action => "hello_world" 65 end 66 end 67 68 class ModuleRedirectTest < Test::Unit::TestCase 69 def setup 70 @controller = ModuleRedirectController.new 71 @request = ActionController::TestRequest.new 72 @response = ActionController::TestResponse.new 73 end 74 75 def test_simple_redirect 76 get :simple_redirect 77 assert_redirect_url "http://test.host/module_test/module_redirect/hello_world" 78 end 79 80 def test_redirect_with_method_reference_and_parameters 81 get :method_redirect 82 assert_redirect_url "http://test.host/module_test/module_redirect/dashboard/1?message=hello" 83 end 84 85 def test_simple_redirect_using_options 86 get :host_redirect 87 assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host' 88 end 89 90 def test_module_redirect 91 get :module_redirect 92 assert_redirect_url "http://test.host/redirect/hello_world" 93 end 94 95 def test_module_redirect_using_options 96 get :module_redirect 97 assert_redirected_to :controller => 'redirect', :action => "hello_world" 98 end 99 end 100 end