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

Commit

Permalink
Adjust max-stale tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aw committed Apr 28, 2015
1 parent 228f7da commit 81d2bfa
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/test_validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ def setup
"X-Cache-Res-Date" => date
}
}
@headers_stale = {
:request => {
"If-Modified-Since" => if_modified,
"Cache-Control" => cache_control
},
:cached => {
"Date" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217},
"Cache-Control" => {
"public" => {"token"=>nil, "quoted_string"=>nil},
"max-stale" => {"token"=>"100", "quoted_string"=>nil}
},
"Last-Modified" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217},
"X-Cache-Req-Date" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217},
"X-Cache-Res-Date" => {"httpdate"=>"Tue, 28 Apr 2015 09:26:57 GMT", "timestamp"=>1430213217}
}
}
@headers_noetag = {
:request => {
"If-None-Match" => ["\"myetag\""]
Expand Down Expand Up @@ -121,7 +137,7 @@ def test_only_if_cached
def test_allow_stale
guard1 = CacheRules.validate_allow_stale? @no_headers
guard2 = CacheRules.validate_allow_stale? @headers_noetag
max_stale = CacheRules.validate_allow_stale? @headers
max_stale = CacheRules.validate_allow_stale? @headers_stale
min_fresh = CacheRules.validate_allow_stale? @cached_rule2
nothing = CacheRules.validate_allow_stale? @headers_nothing

Expand Down

0 comments on commit 81d2bfa

Please sign in to comment.