cache_rules 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/cache_rules.gemspec +1 -1
- data/test/test_cache_rules.rb +15 -4
- data/test/test_helpers.rb +2 -2
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/cache_rules.gemspec
CHANGED
data/test/test_cache_rules.rb
CHANGED
|
@@ -20,15 +20,26 @@ class TestCacheRules < MiniTest::Test
|
|
|
20
20
|
assert_equal got_money, "Dolla Dolla Bill Y'all"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def test_validate_column0_query_params_fail
|
|
24
|
+
request = {"Host"=>"test.url"}
|
|
25
|
+
|
|
26
|
+
result = CacheRules.validate('http://test.url/test1?test=string', request)
|
|
27
|
+
|
|
28
|
+
assert_equal result[:code], 307
|
|
29
|
+
assert_nil result[:body]
|
|
30
|
+
assert_equal result[:headers]['Cache-Lookup'], 'MISS'
|
|
31
|
+
refute_equal result[:headers]['Location'], "http://test.url/test1"
|
|
32
|
+
end
|
|
33
|
+
|
|
23
34
|
def test_validate_column0
|
|
24
35
|
request = {"Host"=>"test.url"}
|
|
25
36
|
|
|
26
|
-
result = CacheRules.validate('http://test.url/test1', request)
|
|
37
|
+
result = CacheRules.validate('http://test.url/test1?test=string', request)
|
|
27
38
|
|
|
28
39
|
assert_equal result[:code], 307
|
|
29
40
|
assert_nil result[:body]
|
|
30
41
|
assert_equal result[:headers]['Cache-Lookup'], 'MISS'
|
|
31
|
-
assert_equal result[:headers]['Location'], "http://test.url/test1"
|
|
42
|
+
assert_equal result[:headers]['Location'], "http://test.url/test1?test=string"
|
|
32
43
|
end
|
|
33
44
|
|
|
34
45
|
def test_validate_column1
|
|
@@ -128,8 +139,8 @@ class TestCacheRules < MiniTest::Test
|
|
|
128
139
|
request = {"Host"=>"test.url", "If-None-Match"=>["*"], "Cache-Control"=>{"max-age"=>{"token"=>"100000000", "quoted_string"=>nil}}}
|
|
129
140
|
cached = {"Date"=>{"httpdate"=>"Sat, 03 Jan 2015 07:03:45 GMT", "timestamp"=>1420268625}, "Cache-Control"=>{"s-maxage"=>{"token"=>"100000000", "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}, "Last-Modified" => {"httpdate"=>"Sat, 03 Jan 2015 07:03:45 GMT", "timestamp"=>1420268625}}
|
|
130
141
|
|
|
131
|
-
FakeWeb.register_uri(:head, "http://test.url/test1", :status => ["304", "Not Modified"], :date => "Sat, 03 Jan 2015 07:15:45 GMT", :Warning => "299 - \"Hello World\"")
|
|
132
|
-
result = CacheRules.revalidate_response('http://test.url/test1', request, cached)
|
|
142
|
+
FakeWeb.register_uri(:head, "http://test.url/test1?test=string", :status => ["304", "Not Modified"], :date => "Sat, 03 Jan 2015 07:15:45 GMT", :Warning => "299 - \"Hello World\"")
|
|
143
|
+
result = CacheRules.revalidate_response('http://test.url/test1?test=string', request, cached)
|
|
133
144
|
|
|
134
145
|
assert_equal result[:code], 200
|
|
135
146
|
assert_equal result[:body], 'cached'
|
data/test/test_helpers.rb
CHANGED
|
@@ -65,7 +65,7 @@ class TestHelpers < MiniTest::Test
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def test_response_request
|
|
68
|
-
url = 'http://test.url'
|
|
68
|
+
url = 'http://test.url?test=string'
|
|
69
69
|
act = CacheRules::REQUEST_TABLE[:actions]
|
|
70
70
|
|
|
71
71
|
column0 = CacheRules.helper_response url, act, 0, @cached_headers
|
|
@@ -78,7 +78,7 @@ class TestHelpers < MiniTest::Test
|
|
|
78
78
|
column7 = CacheRules.helper_response url, act, 7, @cached_headers
|
|
79
79
|
column8 = CacheRules.helper_response url, act, 8, @cached_headers
|
|
80
80
|
|
|
81
|
-
assert_equal column0, {:body=>nil, :code=>307, :headers=>{"Cache-Lookup"=>"MISS", "Location"=>"http://test.url"}}
|
|
81
|
+
assert_equal column0, {:body=>nil, :code=>307, :headers=>{"Cache-Lookup"=>"MISS", "Location"=>"http://test.url?test=string"}}
|
|
82
82
|
assert_equal column1, {:body=>"Gateway Timeout", :code=>504, :headers=>{"Cache-Lookup"=>"MISS"}}
|
|
83
83
|
|
|
84
84
|
assert_equal column2[:body], 'cached'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cache_rules
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2015-02-
|
|
12
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: fakeweb
|