fake_consul 0.0.6 → 0.0.7
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 +5 -1
- data/lib/fake_consul/server.rb +14 -0
- data/lib/fake_consul/version.rb +1 -1
- data/spec/fake_consul/server_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dcc475538dbcc6244fd02c612b765ac0605fd6a
|
4
|
+
data.tar.gz: c33919db807d94272c6e2be527a862f6c3a98f0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce8158985026c4bc964a03537c114a5004bcc1cdbf29be0a913c368a574b327d3f69fd797deae7e22b96339b9cb755b4ae6bfd519bc3cd524150fa5fe7b9c425
|
7
|
+
data.tar.gz: 4b14bba4d679a215cb557d592ecdc28c6bacdcfd14f043030a9f13606857d33f4097034b480cd3801022972cfb96dc7a9a5b0b0ad8124af6fdd470ae6cef5db3
|
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.7] - 2015-12-07
|
6
|
+
- Adds `delete` command
|
7
|
+
|
5
8
|
## [v0.0.6] - 2015-11-27
|
6
9
|
- Add persistance to disk
|
7
10
|
|
@@ -22,7 +25,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
22
25
|
- Adds simple consul client that fakes the consul server and provides state in an in-memory Hash.
|
23
26
|
- 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) )
|
24
27
|
|
25
|
-
[unreleased]: https://github.com/redbooth/fake_consul/compare/v0.0.
|
28
|
+
[unreleased]: https://github.com/redbooth/fake_consul/compare/v0.0.7...HEAD
|
29
|
+
[v0.0.7]: https://github.com/redbooth/fake_consul/tree/v0.0.7
|
26
30
|
[v0.0.6]: https://github.com/redbooth/fake_consul/tree/v0.0.6
|
27
31
|
[v0.0.5]: https://github.com/redbooth/fake_consul/tree/v0.0.5
|
28
32
|
[v0.0.4]: https://github.com/redbooth/fake_consul/tree/v0.0.4
|
data/lib/fake_consul/server.rb
CHANGED
@@ -42,6 +42,20 @@ module FakeConsul
|
|
42
42
|
true
|
43
43
|
end
|
44
44
|
|
45
|
+
# Fake delete
|
46
|
+
#
|
47
|
+
# Performs no http requests but deletes data from local hash
|
48
|
+
#
|
49
|
+
# @param key [String]
|
50
|
+
# @param options [Hash] unused/unimplemented
|
51
|
+
# @return [Boolean] true :trollface:
|
52
|
+
def delete(key, options = nil)
|
53
|
+
super(key)
|
54
|
+
compact
|
55
|
+
persist!
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
45
59
|
# Clear current data
|
46
60
|
# and delete backing marshalling file
|
47
61
|
def clear
|
data/lib/fake_consul/version.rb
CHANGED
@@ -21,6 +21,24 @@ describe FakeConsul::Server do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
describe '#delete' do
|
25
|
+
before { subject.put('foo', 'bar') }
|
26
|
+
|
27
|
+
it 'delete key from Hash' do
|
28
|
+
subject.delete('foo')
|
29
|
+
subject.key?('foo').must_equal false
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'returns true' do
|
33
|
+
subject.put('foo', 'bar').must_equal true
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'compacts the hash to remove keys with nil values' do
|
37
|
+
subject.put('foo', nil)
|
38
|
+
subject.key?('foo').must_equal(false)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
24
42
|
describe '#get' do
|
25
43
|
describe 'simple (no recursing)' do
|
26
44
|
before { subject.put('foo', 'bar') }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_consul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saimon Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|