diff options
author | Christos Zisopoulos <christos@42linesofcode.com> | 2008-12-10 18:38:28 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-12-10 18:38:28 -0600 |
commit | 69387ce0169b95d3a170cfb1c66a7570b1746e37 (patch) | |
tree | 3f607c98710f079c851ee10d75219c1dd7a90be2 | |
parent | 75fa82418d54b36b6092767f2a2b5c1d5324441b (diff) | |
download | rails-69387ce0169b95d3a170cfb1c66a7570b1746e37.tar.gz rails-69387ce0169b95d3a170cfb1c66a7570b1746e37.tar.bz2 rails-69387ce0169b95d3a170cfb1c66a7570b1746e37.zip |
Fix for Integration::Session follow_redirect! headers['location'] bug with Rack [#1555 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
-rw-r--r-- | actionpack/lib/action_controller/integration.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index eeabe5b845..0f0db03b6b 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -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 diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 4735b2927b..6a793c8bb6 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -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 |