itamae 1.2.9 → 1.2.10
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 -0
- data/lib/itamae/resource/base.rb +1 -1
- data/lib/itamae/version.txt +1 -1
- data/spec/unit/lib/itamae/resource/base_spec.rb +12 -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: 62726b5378a313997bc92b497c4345089601ea56
|
|
4
|
+
data.tar.gz: 86e0f81c1404c49733f6a8e99c77d5ab667e840f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f12d5055103bad19ced90d509c9ae4205977ea601fbb2453a93b54f7cc5c2d20d53463535d9c3ad3f402c632436d986dfb96415a6d2ccd8aa2a5733bc3376c3b
|
|
7
|
+
data.tar.gz: 4334497546e84c22381eed578897bd81dd068645cffe39de0a46d80e3cddc760965c06bb3172eca6d3351650d6e988fe2b112583bc3db2f7c9aa6c99308dcc8a
|
data/CHANGELOG.md
CHANGED
data/lib/itamae/resource/base.rb
CHANGED
|
@@ -230,7 +230,7 @@ module Itamae
|
|
|
230
230
|
def process_attributes
|
|
231
231
|
self.class.defined_attributes.each_pair do |key, details|
|
|
232
232
|
@attributes[key] ||= @resource_name if details[:default_name]
|
|
233
|
-
@attributes[key]
|
|
233
|
+
@attributes[key] = details[:default] if details.has_key?(:default) && !@attributes.has_key?(key)
|
|
234
234
|
|
|
235
235
|
if details[:required] && !@attributes[key]
|
|
236
236
|
raise Resource::AttributeMissingError, "'#{key}' attribute is required but it is not set."
|
data/lib/itamae/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.10
|
|
@@ -21,6 +21,18 @@ describe DefineAttributeTestResource do
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
describe "falsey" do
|
|
25
|
+
subject do
|
|
26
|
+
described_class.new(double(:recipe), 'resource name') do
|
|
27
|
+
required_attribute :required_value
|
|
28
|
+
default_attribute nil
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
it "returns the default value" do
|
|
32
|
+
expect(subject.attributes[:default_attribute]).to eq(nil)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
24
36
|
describe "required" do
|
|
25
37
|
subject do
|
|
26
38
|
described_class.new(double(:recipe), 'resource name') do
|