aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/redirect_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-04 05:05:11 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-04 05:05:11 +0000
commit315873041155510fc629e78e4f1567e913935340 (patch)
tree7c72e447f3d64a2fb751b53923e57db62d9bbcab /actionpack/test/controller/redirect_test.rb
parentd4a3eff89d1ffbc6ac613dd74ef4794912beb401 (diff)
downloadrails-315873041155510fc629e78e4f1567e913935340.tar.gz
rails-315873041155510fc629e78e4f1567e913935340.tar.bz2
rails-315873041155510fc629e78e4f1567e913935340.zip
redirect deprecation tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4971 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/redirect_test.rb')
-rwxr-xr-xactionpack/test/controller/redirect_test.rb31
1 files changed, 22 insertions, 9 deletions
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index 84f031923d..575532c1be 100755
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -45,21 +45,25 @@ class RedirectTest < Test::Unit::TestCase
def test_simple_redirect
get :simple_redirect
- assert_redirect_url "http://test.host/redirect/hello_world"
+ assert_response :redirect
+ assert_equal "http://test.host/redirect/hello_world", redirect_to_url
end
def test_redirect_with_method_reference_and_parameters
- get :method_redirect
- assert_redirect_url "http://test.host/redirect/dashboard/1?message=hello"
+ assert_deprecated(/redirect_to/) { get :method_redirect }
+ assert_response :redirect
+ assert_equal "http://test.host/redirect/dashboard/1?message=hello", redirect_to_url
end
def test_simple_redirect_using_options
get :host_redirect
+ assert_response :redirect
assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host'
end
def test_redirect_error_with_pretty_diff
get :host_redirect
+ assert_response :redirect
begin
assert_redirected_to :action => "other_host", :only_path => true
rescue Test::Unit::AssertionFailedError => err
@@ -74,23 +78,27 @@ class RedirectTest < Test::Unit::TestCase
def test_module_redirect
get :module_redirect
- assert_redirect_url "http://test.host/module_test/module_redirect/hello_world"
+ assert_response :redirect
+ assert_redirected_to "http://test.host/module_test/module_redirect/hello_world"
end
def test_module_redirect_using_options
get :module_redirect
+ assert_response :redirect
assert_redirected_to :controller => 'module_test/module_redirect', :action => 'hello_world'
end
def test_redirect_with_assigns
get :redirect_with_assigns
+ assert_response :redirect
assert_equal "world", assigns["hello"]
end
def test_redirect_to_back
@request.env["HTTP_REFERER"] = "http://www.example.com/coming/from"
get :redirect_to_back
- assert_redirect_url "http://www.example.com/coming/from"
+ assert_response :redirect
+ assert_equal "http://www.example.com/coming/from", redirect_to_url
end
def test_redirect_to_back_with_no_referer
@@ -117,26 +125,31 @@ module ModuleTest
def test_simple_redirect
get :simple_redirect
- assert_redirect_url "http://test.host/module_test/module_redirect/hello_world"
+ assert_response :redirect
+ assert_equal "http://test.host/module_test/module_redirect/hello_world", redirect_to_url
end
def test_redirect_with_method_reference_and_parameters
- get :method_redirect
- assert_redirect_url "http://test.host/module_test/module_redirect/dashboard/1?message=hello"
+ assert_deprecated(/redirect_to/) { get :method_redirect }
+ assert_response :redirect
+ assert_equal "http://test.host/module_test/module_redirect/dashboard/1?message=hello", redirect_to_url
end
def test_simple_redirect_using_options
get :host_redirect
+ assert_response :redirect
assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host'
end
def test_module_redirect
get :module_redirect
- assert_redirect_url "http://test.host/redirect/hello_world"
+ assert_response :redirect
+ assert_equal "http://test.host/redirect/hello_world", redirect_to_url
end
def test_module_redirect_using_options
get :module_redirect
+ assert_response :redirect
assert_redirected_to :controller => 'redirect', :action => "hello_world"
end
end