aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorGuo Xiang Tan <tgx_world@hotmail.com>2014-05-13 19:30:57 -0700
committerGuo Xiang Tan <tgx_world@hotmail.com>2014-05-21 23:17:17 -0700
commit4fd144dd4bb0e1ede5a4857c178138088353a3d1 (patch)
tree5fec75f95be2dafcb7b03d98f36fe50d041fabe8 /actionpack/lib/action_dispatch
parent110d3d0c0bceddd05cab86c0463f0aa71df815cb (diff)
downloadrails-4fd144dd4bb0e1ede5a4857c178138088353a3d1.tar.gz
rails-4fd144dd4bb0e1ede5a4857c178138088353a3d1.tar.bz2
rails-4fd144dd4bb0e1ede5a4857c178138088353a3d1.zip
Form full URI as string to be parsed in Rack::Test.
There are performance gains to be made by avoiding URI setter methods.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index cc6b763093..d900f3c7a9 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -300,13 +300,7 @@ module ActionDispatch
# NOTE: rack-test v0.5 doesn't build a default uri correctly
# Make sure requested path is always a full uri
- uri = URI.parse('/')
- uri.scheme ||= env['rack.url_scheme']
- uri.host ||= env['SERVER_NAME']
- uri.port ||= env['SERVER_PORT'].try(:to_i)
- uri += path
-
- session.request(uri.to_s, env)
+ session.request(build_full_uri(path, env), env)
@request_count += 1
@request = ActionDispatch::Request.new(session.last_request.env)
@@ -319,6 +313,10 @@ module ActionDispatch
return response.status
end
+
+ def build_full_uri(path, env)
+ "#{env['rack.url_scheme']}://#{env['SERVER_NAME']}:#{env['SERVER_PORT']}#{path}"
+ end
end
module Runner