diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-04-28 16:25:04 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-04-28 23:29:46 -0500 |
commit | d63b42da362d696398fd371815734cb0caed48df (patch) | |
tree | 8351a959540b17935ca5de8f06be51cb882f6162 | |
parent | afa7d7ff05a0d4787b216d50d609084649f21669 (diff) | |
download | rails-d63b42da362d696398fd371815734cb0caed48df.tar.gz rails-d63b42da362d696398fd371815734cb0caed48df.tar.bz2 rails-d63b42da362d696398fd371815734cb0caed48df.zip |
Move header injection back into integration tests
-rw-r--r-- | actionpack/lib/action_controller/testing/integration.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/test/mock.rb | 12 |
2 files changed, 7 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/testing/integration.rb b/actionpack/lib/action_controller/testing/integration.rb index be5f216e2b..037463e489 100644 --- a/actionpack/lib/action_controller/testing/integration.rb +++ b/actionpack/lib/action_controller/testing/integration.rb @@ -263,7 +263,6 @@ module ActionController opts = { :method => method.to_s.upcase, :params => parameters, - :headers => headers, "SERVER_NAME" => host, "SERVER_PORT" => (https? ? "443" : "80"), @@ -282,6 +281,12 @@ module ActionController } env = ActionDispatch::Test::MockRequest.env_for(@path, opts) + (headers || {}).each do |key, value| + key = key.to_s.upcase.gsub(/-/, "_") + key = "HTTP_#{key}" unless env.has_key?(key) || key =~ /^HTTP_/ + env[key] = value + end + app = Rack::Lint.new(@app) status, headers, body = app.call(env) response = ::Rack::MockResponse.new(status, headers, body) diff --git a/actionpack/lib/action_dispatch/test/mock.rb b/actionpack/lib/action_dispatch/test/mock.rb index 8dc048af11..4042f9fbc8 100644 --- a/actionpack/lib/action_dispatch/test/mock.rb +++ b/actionpack/lib/action_dispatch/test/mock.rb @@ -5,8 +5,6 @@ module ActionDispatch class << self def env_for(path, opts) - headers = opts.delete(:headers) - method = (opts[:method] || opts["REQUEST_METHOD"]).to_s.upcase opts[:method] = opts["REQUEST_METHOD"] = method @@ -48,15 +46,7 @@ module ActionDispatch uri.query = requestify(params) end - env = ::Rack::MockRequest.env_for(uri.to_s, opts) - - (headers || {}).each do |key, value| - key = key.to_s.upcase.gsub(/-/, "_") - key = "HTTP_#{key}" unless env.has_key?(key) || key =~ /^HTTP_/ - env[key] = value - end - - env + ::Rack::MockRequest.env_for(uri.to_s, opts) end private |