cache-client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.4
2
+
3
+ * Fixes handling of ``nil`` argument lists
4
+
1
5
  # 0.0.3
2
6
 
3
7
  * Fixes cache key generation for arrays of keys
data/lib/cache-client.rb CHANGED
@@ -13,6 +13,7 @@ module Cache
13
13
  class Client
14
14
  attr_reader :backend
15
15
  def initialize(backend, *args)
16
+ backend = Cache::Backend::NoopBackend if !args.empty? && args.compact.empty?
16
17
  @backend = backendify(backend).new(*args)
17
18
  end
18
19
 
@@ -1,5 +1,5 @@
1
1
  module Cache
2
2
  class Client
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
- end
5
+ end
@@ -38,6 +38,18 @@ describe Cache::Client do
38
38
  client.backend.args.must_equal([1, 2, 3, {'four' => :five}])
39
39
  end
40
40
 
41
+ it "uses the noop backend if all arguments are nil" do
42
+ client = Cache::Client.new(Cache::InMemoryBackend, 1, 2, 3, {'four' => :five})
43
+ client.backend.kind_of?(Cache::InMemoryBackend).must_equal true
44
+
45
+ client = Cache::Client.new(Cache::InMemoryBackend)
46
+ client.backend.kind_of?(Cache::InMemoryBackend).must_equal true
47
+
48
+ client = Cache::Client.new(Cache::InMemoryBackend, nil)
49
+ client.backend.kind_of?(Cache::InMemoryBackend).must_equal false
50
+ client.backend.kind_of?(Cache::Backend::NoopBackend).must_equal true
51
+ end
52
+
41
53
  describe "that are initialized" do
42
54
  before do
43
55
  @client = Cache::Client.new(Cache::InMemoryBackend)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: