aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/render_test.rb')
-rw-r--r--actionpack/test/controller/render_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 3f047fc9b5..fd8f87e377 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -22,6 +22,18 @@ module Quiz
end
end
+class TestControllerWithExtraEtags < ActionController::Base
+ etag { nil }
+ etag { 'ab' }
+ etag { :cde }
+ etag { [:f] }
+ etag { nil }
+
+ def fresh
+ render text: "stale" if stale?(etag: '123')
+ end
+end
+
class TestController < ActionController::Base
protect_from_forgery
@@ -1626,6 +1638,26 @@ class LastModifiedRenderTest < ActionController::TestCase
end
end
+class EtagRenderTest < ActionController::TestCase
+ tests TestControllerWithExtraEtags
+
+ def setup
+ super
+ @request.host = "www.nextangle.com"
+ end
+
+ def test_multiple_etags
+ @request.if_none_match = %("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key([ "123", 'ab', :cde, [:f] ]))}")
+ get :fresh
+ assert_response :not_modified
+
+ @request.if_none_match = %("nomatch")
+ get :fresh
+ assert_response :success
+ end
+end
+
+
class MetalRenderTest < ActionController::TestCase
tests MetalTestController