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

Commit

Permalink
Add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aw committed Feb 15, 2015
1 parent e7b5cd2 commit 72d4848
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/test_regressions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class TestRegressions < MiniTest::Test

#
# Bugfix tests to ensure we don't allow regressions
#
# https://github.com/aw/CacheRules/issues

def setup
@cached_headers = {
:cached => {
"Date" => {"httpdate"=>"Thu, 01 Jan 2015 07:03:45 GMT", "timestamp"=>1420095825},
"Cache-Control" => {
"public" => {"token"=>nil, "quoted_string"=>nil}
},
"X-Cache-Req-Date" => {"httpdate"=>"Sat, 03 Jan 2015 07:03:45 GMT", "timestamp"=>1420268625},
"X-Cache-Res-Date" => {"httpdate"=>"Sat, 03 Jan 2015 07:03:45 GMT", "timestamp"=>1420268625}
}
}
end

# https://github.com/aw/CacheRules/issues/5
def test_bugfix_5_age_header_string_integer
age_string = CacheRules.action_add_age @cached_headers
age_integer = CacheRules.helper_corrected_initial_age({}, Proc.new { 100 }, Proc.new { 99 }).call

assert_kind_of String, age_string['Age']
assert_kind_of Integer, age_integer
end
end

0 comments on commit 72d4848

Please sign in to comment.