bosh_common 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -81,11 +81,11 @@ module Bosh::Common
|
|
81
81
|
|
82
82
|
names.each do |name|
|
83
83
|
result = lookup_property(@raw_properties, name)
|
84
|
-
return result
|
84
|
+
return result unless result.nil?
|
85
85
|
end
|
86
86
|
|
87
87
|
return default if default_given
|
88
|
-
raise UnknownProperty.new(
|
88
|
+
raise UnknownProperty.new(names)
|
89
89
|
end
|
90
90
|
|
91
91
|
# Run a block of code if all given properties are defined
|
data/lib/common/version.rb
CHANGED
@@ -20,7 +20,9 @@ describe Bosh::Common::TemplateEvaluationContext do
|
|
20
20
|
},
|
21
21
|
"properties" => {
|
22
22
|
"foo" => "bar",
|
23
|
-
"router" => {"token" => "zbb"}
|
23
|
+
"router" => {"token" => "zbb"},
|
24
|
+
"vtrue" => true,
|
25
|
+
"vfalse" => false
|
24
26
|
},
|
25
27
|
"index" => 0,
|
26
28
|
}
|
@@ -43,10 +45,14 @@ describe Bosh::Common::TemplateEvaluationContext do
|
|
43
45
|
|
44
46
|
it "supports 'p' helper" do
|
45
47
|
eval_template("<%= p('router.token') %>", @context).should == "zbb"
|
48
|
+
|
49
|
+
eval_template("<%= p('vtrue') %>", @context).should == "true"
|
50
|
+
eval_template("<%= p('vfalse') %>", @context).should == "false"
|
51
|
+
|
46
52
|
expect {
|
47
53
|
eval_template("<%= p('bar.baz') %>", @context)
|
48
|
-
}.to raise_error(Bosh::Common::UnknownProperty
|
49
|
-
|
54
|
+
}.to raise_error(Bosh::Common::UnknownProperty,
|
55
|
+
"Can't find property `[\"bar.baz\"]'")
|
50
56
|
eval_template("<%= p('bar.baz', 22) %>", @context).should == "22"
|
51
57
|
end
|
52
58
|
|
@@ -59,7 +65,8 @@ describe Bosh::Common::TemplateEvaluationContext do
|
|
59
65
|
eval_template(<<-TMPL, @context)
|
60
66
|
<%= p(%w(a b c)) %>
|
61
67
|
TMPL
|
62
|
-
}.to raise_error(Bosh::Common::UnknownProperty
|
68
|
+
}.to raise_error(Bosh::Common::UnknownProperty,
|
69
|
+
"Can't find property `[\"a\", \"b\", \"c\"]'")
|
63
70
|
|
64
71
|
eval_template(<<-TMPL, @context).strip.should == "22"
|
65
72
|
<%= p(%w(a b c), 22) %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: BOSH common
|
15
15
|
email: support@vmware.com
|