diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-03-13 12:25:32 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-03-13 16:41:00 +0100 |
commit | 9af59b2468e4ad6c3c2ca89f90968fdcaa417aba (patch) | |
tree | 5102f6c010fd469fda0f7ed3161c6f4b6155c113 /actionpack/test/controller | |
parent | e2a5de2bb200773943e605cdddb9b18bbfa77e13 (diff) | |
download | rails-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.rb | 15 |
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 |