aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-05 16:55:17 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-05 16:55:17 +0200
commit4f58b90bab50ab9a3a5d613e4df8dd2b1710732c (patch)
treec0be278857eb4c071edc42b521be5e25ff14c4c5
parent1b0c2146782bd45999e30549fd1d1d1e7cef8266 (diff)
parente767be0779d24fd64e05a07f0284e79576e2b3c4 (diff)
downloadrails-4f58b90bab50ab9a3a5d613e4df8dd2b1710732c.tar.gz
rails-4f58b90bab50ab9a3a5d613e4df8dd2b1710732c.tar.bz2
rails-4f58b90bab50ab9a3a5d613e4df8dd2b1710732c.zip
Merge pull request #15532 from zuhao/refactor_actionpack_response_test
Restore Response.default_headers after test.
-rw-r--r--actionpack/test/dispatch/response_test.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 959a3bc5cd..187b9a2420 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -178,6 +178,7 @@ class ResponseTest < ActiveSupport::TestCase
end
test "read x_frame_options, x_content_type_options and x_xss_protection" do
+ original_default_headers = ActionDispatch::Response.default_headers
begin
ActionDispatch::Response.default_headers = {
'X-Frame-Options' => 'DENY',
@@ -193,11 +194,12 @@ class ResponseTest < ActiveSupport::TestCase
assert_equal('nosniff', resp.headers['X-Content-Type-Options'])
assert_equal('1;', resp.headers['X-XSS-Protection'])
ensure
- ActionDispatch::Response.default_headers = nil
+ ActionDispatch::Response.default_headers = original_default_headers
end
end
test "read custom default_header" do
+ original_default_headers = ActionDispatch::Response.default_headers
begin
ActionDispatch::Response.default_headers = {
'X-XX-XXXX' => 'Here is my phone number'
@@ -209,7 +211,7 @@ class ResponseTest < ActiveSupport::TestCase
assert_equal('Here is my phone number', resp.headers['X-XX-XXXX'])
ensure
- ActionDispatch::Response.default_headers = nil
+ ActionDispatch::Response.default_headers = original_default_headers
end
end