persistent-cache 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Persistent
2
2
  class Cache
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ require File.expand_path('../lib/persistent-cache/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Wynand van Dyk", "Ernst van Graan"]
6
6
  gem.email = ["wvd@hetzner.co.za", "ernst.van.graan@hetzner.co.za"]
7
- gem.description = %q{Persistent Cache using SQLite}
7
+ gem.description = %q{Persistent Cache using a pluggable back-end (e.g. SQLite)}
8
8
  gem.summary = %q{Persistent Cache has a default freshness threshold of 179 days after which entries are no longer returned}
9
9
  gem.homepage = ""
10
10
 
@@ -186,4 +186,26 @@ describe Persistent::Cache do
186
186
  @pcache["three"] = "value three"
187
187
  end
188
188
  end
189
+
190
+ context "when encoding is a requirement" do
191
+ it "should not retrieve values for keys in a different encoding from that it was stored with" do
192
+ setup_cache
193
+ expect(@pcache[@encoded_key]).to eq("some value")
194
+ expect(@pcache["encoded"].nil?).to eq(true)
195
+ end
196
+
197
+ it "should retrieve values for keys stored in an encoding explicitly specified" do
198
+ setup_cache(Encoding::ISO_8859_1)
199
+ expect(@pcache[@encoded_key]).to eq("some value")
200
+ expect(@pcache["encoded"]).to eq("some value")
201
+ end
202
+
203
+ def setup_cache(encoding = nil)
204
+ FileUtils.rm_f(@db_name)
205
+ @pcache = Persistent::Cache.new(@db_name)
206
+ @pcache.encoding = encoding if encoding
207
+ @encoded_key = "encoded".encode!(Encoding::ISO_8859_1)
208
+ @pcache[@encoded_key] = "some value"
209
+ end
210
+ end
189
211
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persistent-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description: Persistent Cache using SQLite
111
+ description: Persistent Cache using a pluggable back-end (e.g. SQLite)
112
112
  email:
113
113
  - wvd@hetzner.co.za
114
114
  - ernst.van.graan@hetzner.co.za