aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-03-13 12:25:32 +0100
committerYves Senn <yves.senn@gmail.com>2013-03-13 16:41:00 +0100
commit9af59b2468e4ad6c3c2ca89f90968fdcaa417aba (patch)
tree5102f6c010fd469fda0f7ed3161c6f4b6155c113 /actionpack/test/controller
parente2a5de2bb200773943e605cdddb9b18bbfa77e13 (diff)
downloadrails-9af59b2468e4ad6c3c2ca89f90968fdcaa417aba.tar.gz
rails-9af59b2468e4ad6c3c2ca89f90968fdcaa417aba.tar.bz2
rails-9af59b2468e4ad6c3c2ca89f90968fdcaa417aba.zip
allow headers and env to be passed in `IntegrationTest`.
Closes #6513.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/integration_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index 72b882539c..c3bdf74d93 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -573,6 +573,21 @@ class MetalIntegrationTest < ActionDispatch::IntegrationTest
def test_generate_url_without_controller
assert_equal 'http://www.example.com/foo', url_for(:controller => "foo")
end
+
+ def test_pass_headers
+ get "/success", {}, "Referer" => "http://www.example.com/foo", "Host" => "http://nohost.com"
+
+ assert_equal "http://nohost.com", @request.env["HTTP_HOST"]
+ assert_equal "http://www.example.com/foo", @request.env["HTTP_REFERER"]
+ end
+
+ def test_pass_env
+ get "/success", {}, "HTTP_REFERER" => "http://test.com/", "HTTP_HOST" => "http://test.com"
+
+ assert_equal "http://test.com", @request.env["HTTP_HOST"]
+ assert_equal "http://test.com/", @request.env["HTTP_REFERER"]
+ end
+
end
class ApplicationIntegrationTest < ActionDispatch::IntegrationTest