aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-09-23 12:08:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-09-23 12:08:32 -0700
commitdb1d4d31c9a270bdb8b8873ec59f18eade94a55f (patch)
treecec84b15644bbc8a5bdae78186f3be76c3fed281
parent39df51e17176b43bf5da8bc53db719d0187423ab (diff)
downloadrails-db1d4d31c9a270bdb8b8873ec59f18eade94a55f.tar.gz
rails-db1d4d31c9a270bdb8b8873ec59f18eade94a55f.tar.bz2
rails-db1d4d31c9a270bdb8b8873ec59f18eade94a55f.zip
don't access the response object before a request was made
It doesn't make sense to access the response object before a request is made (how was a response object created without making a request?) This commit splits testing default headers and default header mutation tests and removes access to the pre-request response object.
-rw-r--r--actionpack/test/controller/test_case_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index 06bf9dec74..40c97abd35 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -974,6 +974,11 @@ class ResponseDefaultHeadersTest < ActionController::TestCase
headers.delete params[:header]
head :ok, 'C' => '3'
end
+
+ # Render a head response, but don't touch default headers
+ def leave_alone
+ head :ok
+ end
end
def before_setup
@@ -999,9 +1004,13 @@ class ResponseDefaultHeadersTest < ActionController::TestCase
end
test "response contains default headers" do
+ get :leave_alone
+
# Response headers start out with the defaults
- assert_equal @defaults, response.headers
+ assert_equal @defaults.merge('Content-Type' => 'text/html'), response.headers
+ end
+ test "response deletes a default header" do
get :remove_header, params: { header: 'A' }
assert_response :ok