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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f34a3a6ee332a8ce2480f41e1071020237c0ae1e
4
- data.tar.gz: e1fc2519d29fc6656e156ffa4d9bf722e8b17297
3
+ metadata.gz: d851a7d541055e460f971cf80a0e06ac22e532e5
4
+ data.tar.gz: 519218770fbff5e98c7fbb9ba6561b6f8af3a75e
5
5
  SHA512:
6
- metadata.gz: aa4045303477608539cc6f844daf4ebade16ac4e3e4ba7ecc5c11a4f9f096c4895893f773708607826dc1428b50814cf5e6e1298330e36f6e5c4f3cc8d5a817c
7
- data.tar.gz: f56ed4f205684f471a39fd471b107e3fb417ffcdb945af2c67ad5d018958bbc93873076e0eeab0b97ac6f4984243aba5d27bf73246480c0a1e675e4009bfbc8c
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
- it 'returns nil if the response is not cached' do
74
- expect(subject.read(request)).to be_nil
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
- it 'decodes a stored response' do
78
- subject.write(request, response)
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
- expect(subject.read(request)).to be_a(Faraday::HttpCache::Response)
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.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-27 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday