Fix for Integration::Session follow_redirect! headers['location'] bug with Rack [#1555 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
Christos Zisopoulos 2008-12-10 18:38:28 -06:00 committed by Joshua Peek
parent 75fa82418d
commit 69387ce016
2 changed files with 5 additions and 9 deletions

View File

@ -126,7 +126,7 @@ module ActionController
# performed on the location header.
def follow_redirect!
raise "not a redirect! #{@status} #{@status_message}" unless redirect?
get(interpret_uri(headers['location'].first))
get(interpret_uri(headers['location']))
status
end

View File

@ -30,14 +30,6 @@ class SessionTest < Test::Unit::TestCase
assert_raise(RuntimeError) { @session.follow_redirect! }
end
def test_follow_redirect_calls_get_and_returns_status
@session.stubs(:redirect?).returns(true)
@session.stubs(:headers).returns({"location" => ["www.google.com"]})
@session.stubs(:status).returns(200)
@session.expects(:get)
assert_equal 200, @session.follow_redirect!
end
def test_request_via_redirect_uses_given_method
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
@session.expects(:put).with(path, args, headers)
@ -323,6 +315,10 @@ class IntegrationProcessTest < ActionController::IntegrationTest
assert_equal "<html><body>You are being <a href=\"http://www.example.com/get\">redirected</a>.</body></html>", response.body
assert_kind_of HTML::Document, html_document
assert_equal 1, request_count
follow_redirect!
assert_response :success
assert_equal "/get", path
end
end