Skip to content

Commit

Permalink
Addresses the Rack 1.1.0 + Cucumber + Facebooker problem described in…
Browse files Browse the repository at this point in the history
  • Loading branch information
agibralter committed Jul 1, 2010
1 parent 240f4e9 commit d183368
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion actionpack/lib/action_controller/integration.rb
Expand Up @@ -383,7 +383,8 @@ def generic_url_rewriter
"REQUEST_URI" => "/",
"HTTP_HOST" => host,
"SERVER_PORT" => https? ? "443" : "80",
"HTTPS" => https? ? "on" : "off"
"HTTPS" => https? ? "on" : "off",
"rack.input" => StringIO.new
}
UrlRewriter.new(Request.new(env), {})
end
Expand Down
20 changes: 20 additions & 0 deletions actionpack/test/controller/integration_test.rb
Expand Up @@ -90,6 +90,26 @@ def test_url_for_without_controller
assert_equal '/show', @session.url_for(options)
end

def test_generic_url_rewriter_request
mock_stringio = mock()
mock_rewriter = mock()
mock_rewriter.stubs(:rewrite)
@session.host! "rubyonrails.com"
@session.stubs(:controller).returns(nil)
StringIO.stubs(:new).returns(mock_stringio)
ActionController::UrlRewriter.stubs(:new).returns(mock_rewriter)
ActionController::Request.expects(:new).with({
'REQUEST_METHOD' => "GET",
'QUERY_STRING' => "",
"REQUEST_URI" => "/",
"HTTP_HOST" => "rubyonrails.com",
"SERVER_PORT" => "80",
"HTTPS" => "off",
"rack.input" => mock_stringio
})
@session.url_for({})
end

def test_redirect_bool_with_status_in_300s
@session.stubs(:status).returns 301
assert @session.redirect?
Expand Down

0 comments on commit d183368

Please sign in to comment.