fake_consul 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aec9fecb3e908f1f6368c526b299a5e91477a27e
4
- data.tar.gz: d675d00b4a11fa6da15652b7bded3eace8df83d7
3
+ metadata.gz: c76b728c0afcb6b01de66f6c2f41537bd05c8486
4
+ data.tar.gz: be681e8dd4ab132ba2c1a906c9a4829412217595
5
5
  SHA512:
6
- metadata.gz: 0c0157f6022d00f42615d8879fb6beac6af0e1dfe2c652a1bd5b024405534e0fe6b098740bc7b1f8732d94e296dbc1e01382af8b6ebfa3334aedd1538964a37d
7
- data.tar.gz: c6640f6d9f06ba00ec67a6b6befd84721d112b3e262d93ad80c0b80bc7ed870abb1d9e09823c99cef47fb0419ba172f932f8d3a0574c7a3c663aeda67a7f2a60
6
+ metadata.gz: 22af7ca02fd95baa3d4a5c0798ab605b00b9ec6563f9d0e5f7e9c7eda3ef0d51828d204043ed0599d1c24c4c3b7b3ce23300df813dbfe625ed0c44c0453514fc
7
+ data.tar.gz: a23224cad965118e9ff884d531f5252f77f896e51ab861a0be7979a630563c432899b238daca3318ab59794ca4cbb61aa93fbbc54990cf5a93565b6627b310f6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [v0.0.4] - 2015-11-27
6
+ - Compact hash on `put` to remove keys with nil values
7
+
5
8
  ## [v0.0.3] - 2015-11-27
6
9
  - Fix double implementation of server
7
10
 
@@ -13,6 +16,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
13
16
  - Adds simple consul client that fakes the consul server and provides state in an in-memory Hash.
14
17
  - Client API conforms to that of [Diplomat::Kv](http://www.rubydoc.info/github/WeAreFarmGeek/diplomat/Diplomat/Kv) (See source here: [Diplomat](https://github.com/WeAreFarmGeek/diplomat) )
15
18
 
16
- [unreleased]: https://github.com/redbooth/fake_consul/compare/v0.0.2...HEAD
19
+ [unreleased]: https://github.com/redbooth/fake_consul/compare/v0.0.4...HEAD
20
+ [v0.0.4]: https://github.com/redbooth/fake_consul/tree/v0.0.4
21
+ [v0.0.3]: https://github.com/redbooth/fake_consul/tree/v0.0.3
17
22
  [v0.0.2]: https://github.com/redbooth/fake_consul/tree/v0.0.2
18
23
  [v0.0.1]: https://github.com/redbooth/fake_consul/tree/v0.0.1
@@ -30,6 +30,7 @@ module FakeConsul
30
30
  # @return [Boolean] true :trollface:
31
31
  def put(key, value, options = nil)
32
32
  self[key] = value
33
+ compact
33
34
  true
34
35
  end
35
36
 
@@ -54,5 +55,10 @@ module FakeConsul
54
55
  consul_export_format(_key)
55
56
  end.flatten
56
57
  end
58
+
59
+ # Remove all keys that are nil
60
+ def compact
61
+ delete_if { |k, v| v.nil? }
62
+ end
57
63
  end
58
64
  end
@@ -1,3 +1,3 @@
1
1
  module FakeConsul
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -12,6 +12,11 @@ describe FakeConsul::Server do
12
12
  it 'returns true' do
13
13
  subject.put('foo', 'bar').must_equal true
14
14
  end
15
+
16
+ it 'compacts the hash to remove keys with nil values' do
17
+ subject.put('foo', nil)
18
+ subject.key?('foo').must_equal(false)
19
+ end
15
20
  end
16
21
 
17
22
  describe '#get' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_consul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saimon Moore