aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 08:34:02 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 08:34:02 +0000
commitb4fe4daa840741dce464b3c9ff5a7e447375bdd5 (patch)
tree72384d46ec3069b98358236cccb645d5939c75b7
parentc29cfe389e5ba27e75d05a23823ebe7abe22e9d0 (diff)
downloadrails-b4fe4daa840741dce464b3c9ff5a7e447375bdd5.tar.gz
rails-b4fe4daa840741dce464b3c9ff5a7e447375bdd5.tar.bz2
rails-b4fe4daa840741dce464b3c9ff5a7e447375bdd5.zip
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
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/assertions.rb2
-rwxr-xr-xactionpack/test/controller/redirect_test.rb11
3 files changed, 13 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index ba7b22b7f7..e751c88af8 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 e46e868ff5..00388f8f59 100644
--- a/actionpack/lib/action_controller/assertions.rb
+++ b/actionpack/lib/action_controller/assertions.rb
@@ -57,7 +57,7 @@ module Test #:nodoc:
@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 fafff144df..ee20457508 100755
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -9,6 +9,10 @@ class RedirectController < ActionController::Base
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 @@ class RedirectTest < Test::Unit::TestCase
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