aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-06-23 20:32:26 +0300
committerMichael Koziarski <michael@koziarski.com>2008-07-04 10:41:40 +0300
commitdb5839107951b000633fa8405f78e5c315b6656a (patch)
treebfb05cdd47e66647ea81a921767f13f49d23025a
parent51e13d51adee3c69feab30aa4c0b08d2278ccc5f (diff)
downloadrails-db5839107951b000633fa8405f78e5c315b6656a.tar.gz
rails-db5839107951b000633fa8405f78e5c315b6656a.tar.bz2
rails-db5839107951b000633fa8405f78e5c315b6656a.zip
Remove old broken follow_redirect from functional tests. Still works in integration tests.
The follow_redirect in functional tests only worked if you used redirect_to :id=>foo, :action=>bar, rather than named routes.
-rw-r--r--actionpack/CHANGELOG5
-rw-r--r--actionpack/lib/action_controller/test_process.rb9
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb16
-rw-r--r--actionpack/test/controller/test_test.rb18
4 files changed, 5 insertions, 43 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index c42d3825e3..7f275bef27 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -18,6 +18,11 @@
* Made ActionView::Base#render_file private [Josh Peek]
+* Remove follow_redirect from controller functional tests.
+
+ If you want to follow redirects you can use integration tests. The functional test
+ version was only useful if you were using redirect_to :id=>...
+
* Fix polymorphic_url with singleton resources. #461 [Tammer Saleh]
* Replaced TemplateFinder abstraction with ViewLoadPaths [Josh Peek]
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index 0cf143210d..8ae73a66f4 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -404,15 +404,6 @@ module ActionController #:nodoc:
end
alias xhr :xml_http_request
- def follow_redirect
- redirected_controller = @response.redirected_to[:controller]
- if redirected_controller && redirected_controller != @controller.controller_name
- raise "Can't follow redirects outside of current controller (from #{@controller.controller_name} to #{redirected_controller})"
- end
-
- get(@response.redirected_to.delete(:action), @response.redirected_to.stringify_keys)
- end
-
def assigns(key = nil)
if key.nil?
@response.template.assigns
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index 7a90a9408e..eae05aacab 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -419,22 +419,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
assert_equal "Mr. David", @response.body
end
- def test_follow_redirect
- process :redirect_to_action
- assert_redirected_to :action => "flash_me"
-
- follow_redirect
- assert_equal 1, @request.parameters["id"].to_i
-
- assert "Inconceivable!", @response.body
- end
-
- def test_follow_redirect_outside_current_action
- process :redirect_to_controller
- assert_redirected_to :controller => "elsewhere", :action => "flash_me"
-
- assert_raises(RuntimeError, "Can't follow redirects outside of current controller (elsewhere)") { follow_redirect }
- end
def test_assert_redirection_fails_with_incorrect_controller
process :redirect_to_controller
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 38898a1f75..b624005a57 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -566,24 +566,6 @@ XML
assert_raise(RuntimeError) { ActionController::TestUploadedFile.new('non_existent_file') }
end
- def test_assert_follow_redirect_to_same_controller
- with_foo_routing do |set|
- get :redirect_to_same_controller
- assert_response :redirect
- assert_redirected_to :controller => 'test_test/test', :action => 'test_uri', :id => 5
- assert_nothing_raised { follow_redirect }
- end
- end
-
- def test_assert_follow_redirect_to_different_controller
- with_foo_routing do |set|
- get :redirect_to_different_controller
- assert_response :redirect
- assert_redirected_to :controller => 'fail', :id => 5
- assert_raise(RuntimeError) { follow_redirect }
- end
- end
-
def test_redirect_url_only_cares_about_location_header
get :create
assert_response :created