From 3a24247b95e21e093ab706e394de392220cc4929 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Sun, 17 Apr 2016 23:06:26 +0530 Subject: [PATCH] Properly verify that cache accepts and user `expires` value. --- actionpack/test/controller/caching_test.rb | 5 ++++- .../functional_caching/fragment_cached_with_options.html.erb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 754ac144cce65..7faf3cd8c6fbd 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -219,12 +219,15 @@ def test_skipping_fragment_cache_digesting end def test_fragment_caching_with_options + time = Time.now get :fragment_cached_with_options assert_response :success expected_body = "\n

ERB

\n\n" assert_equal expected_body, @response.body - assert_equal "

ERB

", @store.read("views/with_options") + Time.stub(:now, time + 11) do + assert_nil @store.read("views/with_options") + end end def test_render_inline_before_fragment_caching diff --git a/actionpack/test/fixtures/functional_caching/fragment_cached_with_options.html.erb b/actionpack/test/fixtures/functional_caching/fragment_cached_with_options.html.erb index 01453323ef149..951c761995305 100644 --- a/actionpack/test/fixtures/functional_caching/fragment_cached_with_options.html.erb +++ b/actionpack/test/fixtures/functional_caching/fragment_cached_with_options.html.erb @@ -1,3 +1,3 @@ -<%= cache 'with_options', skip_digest: true, expires_in: 1.minute do %>

ERB

<% end %> +<%= cache 'with_options', skip_digest: true, expires_in: 10 do %>

ERB

<% end %>