mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
51e13d51ad
commit
db58391079
4 changed files with 5 additions and 43 deletions
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue