aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2017-09-05 09:44:54 -0700
committerGitHub <noreply@github.com>2017-09-05 09:44:54 -0700
commit18f342d82a380d5bd23c33018818224d32b69a95 (patch)
treebd4e9c644af6e566244cdb4b49134a3b03abe746 /actionpack/test
parent6c4a32e27ddadc58673a36f47ca28f74b09c9ed0 (diff)
parent651ec51fc5b3d044083d301e571ff108ab02d62f (diff)
downloadrails-18f342d82a380d5bd23c33018818224d32b69a95.tar.gz
rails-18f342d82a380d5bd23c33018818224d32b69a95.tar.bz2
rails-18f342d82a380d5bd23c33018818224d32b69a95.zip
Merge pull request #30367 from ptoomey3/consistent-cache-control-headers
Normalize/process Cache-Control headers consistently
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/render_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 1ca668b9b1..37a62edc15 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -162,6 +162,17 @@ class TestController < ActionController::Base
render action: "hello_world"
end
+ def conditional_hello_with_expires_and_confliciting_cache_control_headers
+ response.headers["Cache-Control"] = "no-cache, must-revalidate"
+ expires_now
+ render action: "hello_world"
+ end
+
+ def conditional_hello_without_expires_and_confliciting_cache_control_headers
+ response.headers["Cache-Control"] = "no-cache, must-revalidate"
+ render action: "hello_world"
+ end
+
def conditional_hello_with_bangs
render action: "hello_world"
end
@@ -368,6 +379,16 @@ class ExpiresInRenderTest < ActionController::TestCase
assert_match(/no-transform/, @response.headers["Cache-Control"])
end
+ def test_expires_now_with_conflicting_cache_control_headers
+ get :conditional_hello_with_expires_and_confliciting_cache_control_headers
+ assert_equal "no-cache", @response.headers["Cache-Control"]
+ end
+
+ def test_no_expires_now_with_conflicting_cache_control_headers
+ get :conditional_hello_without_expires_and_confliciting_cache_control_headers
+ assert_equal "no-cache", @response.headers["Cache-Control"]
+ end
+
def test_date_header_when_expires_in
time = Time.mktime(2011, 10, 30)
Time.stub :now, time do