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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5514849fd07f64a8e08cddcd429e6dbd366ad79
4
- data.tar.gz: 7844bbff4c0e017f03bcb540e18ae797499903af
3
+ metadata.gz: 62726b5378a313997bc92b497c4345089601ea56
4
+ data.tar.gz: 86e0f81c1404c49733f6a8e99c77d5ab667e840f
5
5
  SHA512:
6
- metadata.gz: c59c0be2d8f9b0270ec042ee839f6766d7f832aac8fb0c3724c2c3de3647348983264b747f251dfd89528b50fbdfbfbb50dfd528dff7e6c40e181d46b00d4ce4
7
- data.tar.gz: e4d08541ddf828cd2d716a8bd13640c4a67ef16cb2fce234281538146a34cc238c6a8ac56dd0991b507d255c20c1433e53b3acc077b9da9564e589d8f8144d62
6
+ metadata.gz: f12d5055103bad19ced90d509c9ae4205977ea601fbb2453a93b54f7cc5c2d20d53463535d9c3ad3f402c632436d986dfb96415a6d2ccd8aa2a5733bc3376c3b
7
+ data.tar.gz: 4334497546e84c22381eed578897bd81dd068645cffe39de0a46d80e3cddc760965c06bb3172eca6d3351650d6e988fe2b112583bc3db2f7c9aa6c99308dcc8a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.2.10
2
+
3
+ Bugfixes
4
+
5
+ - [Use given attribute value even if it's falsey (by @sorah)](https://github.com/itamae-kitchen/itamae/pull/117)
6
+
1
7
  ## v1.2.9
2
8
 
3
9
  Bugfixes
@@ -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] ||= details[:default] if details[:default]
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."
@@ -1 +1 @@
1
- 1.2.9
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai