hiera-json 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/spec/json_backend_spec.rb +16 -0
- metadata +20 -12
data/spec/json_backend_spec.rb
CHANGED
@@ -36,6 +36,22 @@ class Hiera
|
|
36
36
|
@backend.lookup("key", {}, nil, :priority)
|
37
37
|
end
|
38
38
|
|
39
|
+
it "should retain the data types found in data files" do
|
40
|
+
Backend.expects(:datasources).yields("one").times(3)
|
41
|
+
Backend.expects(:datafile).with(:json, {}, "one", "json").returns("/nonexisting/one.json").times(3)
|
42
|
+
File.expects(:read).with("/nonexisting/one.json").returns('{"stringval":"string",
|
43
|
+
"boolval":true,
|
44
|
+
"numericval":1}').times(3)
|
45
|
+
|
46
|
+
Backend.stubs(:parse_answer).with('string', {}).returns('string')
|
47
|
+
Backend.stubs(:parse_answer).with(true, {}).returns(true)
|
48
|
+
Backend.stubs(:parse_answer).with(1, {}).returns(1)
|
49
|
+
|
50
|
+
@backend.lookup("stringval", {}, nil, :priority).should == "string"
|
51
|
+
@backend.lookup("boolval", {}, nil, :priority).should == true
|
52
|
+
@backend.lookup("numericval", {}, nil, :priority).should == 1
|
53
|
+
end
|
54
|
+
|
39
55
|
it "should pick data earliest source that has it for priority searches" do
|
40
56
|
scope = {"rspec" => "test"}
|
41
57
|
Backend.stubs(:parse_answer).with('answer', scope).returns("answer")
|
metadata
CHANGED
@@ -1,50 +1,54 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 3
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
|
-
-
|
13
|
+
- Puppet Labs
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2012-01-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: hiera
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ~>
|
26
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 19
|
27
29
|
segments:
|
28
30
|
- 0
|
29
|
-
-
|
31
|
+
- 3
|
30
32
|
- 0
|
31
|
-
version: 0.
|
33
|
+
version: 0.3.0
|
32
34
|
type: :runtime
|
33
35
|
version_requirements: *id001
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
37
|
name: json
|
36
38
|
prerelease: false
|
37
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
38
41
|
requirements:
|
39
42
|
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
41
45
|
segments:
|
42
46
|
- 0
|
43
47
|
version: "0"
|
44
48
|
type: :runtime
|
45
49
|
version_requirements: *id002
|
46
50
|
description: Store Hiera data in JSON
|
47
|
-
email:
|
51
|
+
email: info@puppetlabs.com
|
48
52
|
executables: []
|
49
53
|
|
50
54
|
extensions: []
|
@@ -53,8 +57,8 @@ extra_rdoc_files: []
|
|
53
57
|
|
54
58
|
files:
|
55
59
|
- lib/hiera/backend/json_backend.rb
|
56
|
-
|
57
|
-
homepage: https://github.com/
|
60
|
+
- spec/json_backend_spec.rb
|
61
|
+
homepage: https://github.com/puppetlabs/hiera-json/
|
58
62
|
licenses: []
|
59
63
|
|
60
64
|
post_install_message:
|
@@ -63,23 +67,27 @@ rdoc_options: []
|
|
63
67
|
require_paths:
|
64
68
|
- lib
|
65
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
66
71
|
requirements:
|
67
72
|
- - ">="
|
68
73
|
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
69
75
|
segments:
|
70
76
|
- 0
|
71
77
|
version: "0"
|
72
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
73
80
|
requirements:
|
74
81
|
- - ">="
|
75
82
|
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
76
84
|
segments:
|
77
85
|
- 0
|
78
86
|
version: "0"
|
79
87
|
requirements: []
|
80
88
|
|
81
89
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.8.10
|
83
91
|
signing_key:
|
84
92
|
specification_version: 3
|
85
93
|
summary: JSON backend for the Hiera hierarcical data store
|