Fixed assert_redirected_to to work with :only_path => false #1204 [Alisdair McDiarmid]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1251 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 c29cfe38
*SVN* *SVN*
* Fixed assert_redirected_to to work with :only_path => false #1204 [Alisdair McDiarmid]
* Fixed render_partial_collection to output an empty string instead of nil when handed an empty array #1202 [Ryan Carver] * Fixed render_partial_collection to output an empty string instead of nil when handed an empty array #1202 [Ryan Carver]
* Improved the speed of regular expression expirations for caching by a factor of 10 #1221 [Jamis Buck] * Improved the speed of regular expression expirations for caching by a factor of 10 #1221 [Jamis Buck]
......
...@@ -57,7 +57,7 @@ def assert_redirected_to(options = {}, message=nil) ...@@ -57,7 +57,7 @@ def assert_redirected_to(options = {}, message=nil)
@response.redirected_to == options @response.redirected_to == options
else else
options.keys.all? do |k| options.keys.all? do |k|
options[k] == (@response.redirected_to[k].respond_to?(:to_param) ? @response.redirected_to[k].to_param : @response.redirected_to[k] if @response.redirected_to[k]) options[k] == (@response.redirected_to[k].respond_to?(:to_param) ? @response.redirected_to[k].to_param : @response.redirected_to[k] unless @response.redirected_to[k].nil?)
end end
end end
end end
......
...@@ -9,6 +9,10 @@ def method_redirect ...@@ -9,6 +9,10 @@ def method_redirect
redirect_to :dashbord_url, 1, "hello" redirect_to :dashbord_url, 1, "hello"
end end
def host_redirect
redirect_to :action => "other_host", :only_path => false, :host => 'other.test.host'
end
def rescue_errors(e) raise e end def rescue_errors(e) raise e end
protected protected
...@@ -33,4 +37,9 @@ def test_redirect_with_method_reference_and_parameters ...@@ -33,4 +37,9 @@ def test_redirect_with_method_reference_and_parameters
get :method_redirect get :method_redirect
assert_redirect_url "http://test.host/redirect/dashboard/1?message=hello" assert_redirect_url "http://test.host/redirect/dashboard/1?message=hello"
end end
end
\ No newline at end of file def test_simple_redirect_using_options
get :host_redirect
assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host'
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册