diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-06-19 08:52:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-19 08:52:16 -0400 |
commit | 2be5ef6a1d5baebcb749c42a48628c741570fd73 (patch) | |
tree | b9274f359a069c26b999740125e62eb3f9d59750 /actionpack/test | |
parent | 433a3122697e41bb46c4f072d2d8223233af5dd4 (diff) | |
parent | c94a00757dac150b17d9272b72288217c66f0a2d (diff) | |
download | rails-2be5ef6a1d5baebcb749c42a48628c741570fd73.tar.gz rails-2be5ef6a1d5baebcb749c42a48628c741570fd73.tar.bz2 rails-2be5ef6a1d5baebcb749c42a48628c741570fd73.zip |
Merge pull request #33134 from dasch/dasch/extra-cache-controls
Add support for more HTTP cache controls
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 24c5761e41..6e3bd0596b 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -141,6 +141,16 @@ class TestController < ActionController::Base render action: "hello_world" end + def conditional_hello_with_expires_in_with_stale_while_revalidate + expires_in 1.minute, public: true, stale_while_revalidate: 5.minutes + render action: "hello_world" + end + + def conditional_hello_with_expires_in_with_stale_if_error + expires_in 1.minute, public: true, stale_if_error: 5.minutes + render action: "hello_world" + end + def conditional_hello_with_expires_in_with_public_with_more_keys expires_in 1.minute, :public => true, "s-maxage" => 5.hours render action: "hello_world" @@ -358,6 +368,16 @@ class ExpiresInRenderTest < ActionController::TestCase assert_equal "max-age=60, public, must-revalidate", @response.headers["Cache-Control"] end + def test_expires_in_header_with_stale_while_revalidate + get :conditional_hello_with_expires_in_with_stale_while_revalidate + assert_equal "max-age=60, public, stale-while-revalidate=300", @response.headers["Cache-Control"] + end + + def test_expires_in_header_with_stale_if_error + get :conditional_hello_with_expires_in_with_stale_if_error + assert_equal "max-age=60, public, stale-if-error=300", @response.headers["Cache-Control"] + end + def test_expires_in_header_with_additional_headers get :conditional_hello_with_expires_in_with_public_with_more_keys assert_equal "max-age=60, public, s-maxage=18000", @response.headers["Cache-Control"] |