chef_cap 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ChefCap
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -6,13 +6,17 @@ class ChefCapHelper
6
6
 
7
7
  def parse_hash(hash, prefix = nil)
8
8
  hash.each do |key, value|
9
- next if value.nil?
10
9
  if value.is_a? Hash
11
10
  parse_hash(value, [prefix, key].compact.join("_"))
12
11
  else
13
12
  key = [prefix, key].compact.join("_").to_sym
14
- debug("Setting #{key.inspect} => #{value.inspect}")
15
- ChefCapConfiguration.configuration.set key, value
13
+ unless value.nil?
14
+ debug("Setting #{key.inspect} => #{value.inspect}")
15
+ ChefCapConfiguration.configuration.set key, value
16
+ else
17
+ debug("Unsetting #{key.inspect} => #{value.inspect}")
18
+ ChefCapConfiguration.configuration.unset key, value
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -44,6 +44,7 @@ describe ChefCapHelper do
44
44
  end
45
45
 
46
46
  it "should unset null values" do
47
+ @configuration.should_receive(:unset).with(:somekey, nil)
47
48
  @configuration.should_not_receive(:set)
48
49
  ChefCapHelper.parse_hash({"somekey" => nil})
49
50
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Case Commons, LLC