File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class Hash
5
5
def recursive_merge! ( other )
6
6
other . keys . each do |k |
7
7
if self [ k ] . is_a? ( Array ) && other [ k ] . is_a? ( Array )
8
- self [ k ] + = other [ k ]
8
+ self [ k ] = other [ k ]
9
9
elsif self [ k ] . is_a? ( Hash ) && other [ k ] . is_a? ( Hash )
10
10
self [ k ] . recursive_merge! ( other [ k ] )
11
11
else
Original file line number Diff line number Diff line change 5
5
6
6
Gem ::Specification . new do |s |
7
7
s . name = %q{mc-settings}
8
- s . version = "0.1.0 "
8
+ s . version = "0.1.2 "
9
9
10
10
s . required_rubygems_version = Gem ::Requirement . new ( ">= 0" ) if s . respond_to? :required_rubygems_version=
11
- s . authors = [ "Edwin Cruz" , "Colin Shield " ]
12
- s . date = %q{2010-12-28 }
11
+ s . authors = [ "Edwin Cruz" , "Konstantin Gredeskoul " ]
12
+ s . date = %q{2011-01-18 }
13
13
s . description = %q{implement custom keys indenendently of environment}
14
14
s . email = %q{rubydev@modcloth.com}
15
15
s . extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
"lib/mc-settings.rb" ,
28
28
"lib/setting.rb" ,
29
29
"mc-settings.gemspec" ,
30
+ "spec/fixtures/joes-colors.yml" ,
30
31
"spec/fixtures/sample.yml" ,
31
32
"spec/mc_settings_spec.rb" ,
32
33
"spec/spec_helper.rb" ,
Original file line number Diff line number Diff line change 52
52
it "should create keys if it does not exist" do
53
53
Setting . test_specific . should == "exist"
54
54
end
55
+
56
+ context "working with arrays" do
57
+ it "should replace the whole array instead of appending new values" do
58
+ Setting . nested_array . should == [ 'first' , 'four' , 'five' ]
59
+ end
60
+ end
55
61
end
56
62
57
63
context "When running with threads" do
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ def stub_setting_files
20
20
default: 7
21
21
flag_false:
22
22
default: false
23
+ nested_array:
24
+ - first
25
+ - second
26
+ - third
23
27
CONTENT
24
28
test = <<-CONTENT
25
29
one: test
@@ -30,6 +34,10 @@ def stub_setting_files
30
34
six:
31
35
extra: "recursively overriden"
32
36
test_specific: "exist"
37
+ nested_array:
38
+ - first
39
+ - four
40
+ - five
33
41
CONTENT
34
42
35
43
empty = <<-CONTENT
You can’t perform that action at this time.
0 commit comments