fake_consul 0.0.3 → 0.0.4
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/CHANGELOG.md +6 -1
- data/lib/fake_consul/server.rb +6 -0
- data/lib/fake_consul/version.rb +1 -1
- data/spec/fake_consul/server_spec.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c76b728c0afcb6b01de66f6c2f41537bd05c8486
|
4
|
+
data.tar.gz: be681e8dd4ab132ba2c1a906c9a4829412217595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
data/lib/fake_consul/server.rb
CHANGED
@@ -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
|
data/lib/fake_consul/version.rb
CHANGED
@@ -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
|