faraday-http-cache 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/lib/faraday/http_cache/storage.rb +1 -1
- data/spec/storage_spec.rb +21 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d851a7d541055e460f971cf80a0e06ac22e532e5
|
4
|
+
data.tar.gz: 519218770fbff5e98c7fbb9ba6561b6f8af3a75e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b13880d63d13760de6e4759b1315311412ca445f706b80e9dcb4a4fc7a23bdb22f976f5fbd77e6782ed62b0fa2e5c9e48c0806cbf4e5e137ab038ad0ea2739d2
|
7
|
+
data.tar.gz: 8945bb6f2bf29e4f9e6578eb40c4fcaa2d1c0502ad1c22963ae0bfab6c7f848d0fdac4df1f9010225c67e9461d23bedecfeaf4f61782fab28c6bfc3063ac7866
|
@@ -110,7 +110,7 @@ module Faraday
|
|
110
110
|
#
|
111
111
|
# Returns true or false.
|
112
112
|
def response_matches?(request, cached_request, cached_response)
|
113
|
-
request.method.to_s == cached_request[:method] &&
|
113
|
+
request.method.to_s == cached_request[:method].to_s &&
|
114
114
|
vary_matches?(cached_response, request, cached_request)
|
115
115
|
end
|
116
116
|
|
data/spec/storage_spec.rb
CHANGED
@@ -70,14 +70,30 @@ describe Faraday::HttpCache::Storage do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
describe 'reading responses' do
|
73
|
-
|
74
|
-
|
73
|
+
let(:storage) { Faraday::HttpCache::Storage.new(store: cache, serializer: serializer) }
|
74
|
+
|
75
|
+
shared_examples 'A storage with serialization' do
|
76
|
+
it 'returns nil if the response is not cached' do
|
77
|
+
expect(subject.read(request)).to be_nil
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'decodes a stored response' do
|
81
|
+
subject.write(request, response)
|
82
|
+
|
83
|
+
expect(subject.read(request)).to be_a(Faraday::HttpCache::Response)
|
84
|
+
end
|
75
85
|
end
|
76
86
|
|
77
|
-
|
78
|
-
|
87
|
+
context 'with the JSON serializer' do
|
88
|
+
let(:serializer) { JSON }
|
89
|
+
|
90
|
+
it_behaves_like 'A storage with serialization'
|
91
|
+
end
|
79
92
|
|
80
|
-
|
93
|
+
context 'with the Marshal serializer' do
|
94
|
+
let(:serializer) { Marshal }
|
95
|
+
|
96
|
+
it_behaves_like 'A storage with serialization'
|
81
97
|
end
|
82
98
|
end
|
83
99
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-http-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Mazza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|