Skip to content

Commit

Permalink
Fixed assert_redirected_to to work with :only_path => false #1204 [Al…
Browse files Browse the repository at this point in the history
…isdair McDiarmid]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1251 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Apr 30, 2005
1 parent c29cfe3 commit b4fe4da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion actionpack/test/controller/redirect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

def test_simple_redirect_using_options
get :host_redirect
assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host'
end
end

0 comments on commit b4fe4da

Please sign in to comment.