Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit 81d2bfa

Browse files
committed
Adjust max-stale tests
1 parent 228f7da commit 81d2bfa

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

test/test_validations.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ def setup
2626
"X-Cache-Res-Date" => date
2727
}
2828
}
29+
@headers_stale = {
30+
:request => {
31+
"If-Modified-Since" => if_modified,
32+
"Cache-Control" => cache_control
33+
},
34+
:cached => {
35+
"Date" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217},
36+
"Cache-Control" => {
37+
"public" => {"token"=>nil, "quoted_string"=>nil},
38+
"max-stale" => {"token"=>"100", "quoted_string"=>nil}
39+
},
40+
"Last-Modified" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217},
41+
"X-Cache-Req-Date" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217},
42+
"X-Cache-Res-Date" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217}
43+
}
44+
}
2945
@headers_noetag = {
3046
:request => {
3147
"If-None-Match" => ["\"myetag\""]
@@ -121,7 +137,7 @@ def test_only_if_cached
121137
def test_allow_stale
122138
guard1 = CacheRules.validate_allow_stale? @no_headers
123139
guard2 = CacheRules.validate_allow_stale? @headers_noetag
124-
max_stale = CacheRules.validate_allow_stale? @headers
140+
max_stale = CacheRules.validate_allow_stale? @headers_stale
125141
min_fresh = CacheRules.validate_allow_stale? @cached_rule2
126142
nothing = CacheRules.validate_allow_stale? @headers_nothing
127143

0 commit comments

Comments
 (0)