diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index ba7b22b7f7f11926b9d1d51beff3c75d4954db6f..e751c88af88c35a0a9b7547b85840d7aa3e28c70 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *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] * Improved the speed of regular expression expirations for caching by a factor of 10 #1221 [Jamis Buck] diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb index e46e868ff57333059cece2f6bd9d9bae82b3c27b..00388f8f59bcc8cc7f53abde0f72720f078bd580 100644 --- a/actionpack/lib/action_controller/assertions.rb +++ b/actionpack/lib/action_controller/assertions.rb @@ -57,7 +57,7 @@ def assert_redirected_to(options = {}, message=nil) @response.redirected_to == options else 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 diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index fafff144dfc9a4cc1dfc9e03d3813dad41f9aa22..ee20457508b353268e79964fcc1d2829f5fa2501 100755 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -9,6 +9,10 @@ def method_redirect redirect_to :dashbord_url, 1, "hello" end + def host_redirect + redirect_to :action => "other_host", :only_path => false, :host => 'other.test.host' + end + def rescue_errors(e) raise e end protected @@ -33,4 +37,9 @@ def test_redirect_with_method_reference_and_parameters get :method_redirect assert_redirect_url "http://test.host/redirect/dashboard/1?message=hello" 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