diff --git a/Gemfile.lock b/Gemfile.lock
index 68f4b73..965ce03 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -83,7 +83,7 @@ GEM
tzinfo (~> 1.1)
arel (6.0.0)
bcrypt (3.1.10)
- bourbon (4.2.1)
+ bourbon (4.2.2)
sass (~> 3.4)
thor
builder (3.2.2)
@@ -98,7 +98,7 @@ GEM
cocaine (0.5.7)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
- coffee-script (2.3.0)
+ coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1)
@@ -106,7 +106,7 @@ GEM
mime-types (~> 1.15)
multi_json (~> 1.0)
rest-client (~> 1.6.1)
- daemons (1.1.9)
+ daemons (1.2.2)
devise (3.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
@@ -119,7 +119,7 @@ GEM
activemodel
erubis (2.7.0)
eventmachine (1.0.7)
- execjs (2.4.0)
+ execjs (2.5.0)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
@@ -127,10 +127,10 @@ GEM
railties (>= 3.0.0)
font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0)
- foundation-rails (5.5.1.0)
+ foundation-rails (5.5.1.1)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
- globalid (0.3.3)
+ globalid (0.3.4)
activesupport (>= 4.1.0)
hike (1.2.3)
i18n (0.7.0)
@@ -159,7 +159,7 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- pry-rails (0.3.3)
+ pry-rails (0.3.4)
pry (>= 0.9.10)
rack (1.6.0)
rack-test (0.6.3)
@@ -177,11 +177,11 @@ GEM
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
- rails-dom-testing (1.0.5)
+ rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
- rails-html-sanitizer (1.0.1)
+ rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
railties (4.2.0)
actionpack (= 4.2.0)
@@ -195,9 +195,9 @@ GEM
rest-client (1.6.8)
mime-types (~> 1.16)
rdoc (>= 2.4.2)
- rspec-core (3.2.1)
+ rspec-core (3.2.3)
rspec-support (~> 3.2.0)
- rspec-expectations (3.2.0)
+ rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-its (1.2.0)
@@ -216,13 +216,13 @@ GEM
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
sass (3.4.13)
- sass-rails (5.0.1)
+ sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
- slim (3.0.2)
+ slim (3.0.3)
temple (~> 0.7.3)
tilt (>= 1.3.3, < 2.1)
slim-rails (3.0.1)
@@ -250,7 +250,7 @@ GEM
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.19.1)
- thread_safe (0.3.4)
+ thread_safe (0.3.5)
tilt (1.4.1)
tinymce-rails (4.1.6)
railties (>= 3.1.1)
diff --git a/app/models/cmtool/yml_file.rb b/app/models/cmtool/yml_file.rb
index b79d8a3..2662420 100644
--- a/app/models/cmtool/yml_file.rb
+++ b/app/models/cmtool/yml_file.rb
@@ -9,7 +9,7 @@ module Cmtool
def self.all_as_object
all.each.with_object Hash.new do |yml_file, obj|
yml_obj = YAML.load(yml_file.body) rescue nil
- obj.merge!( yml_obj ) if yml_obj
+ obj.deep_merge!( yml_obj ) if yml_obj
end
end
end
diff --git a/spec/models/cmtool/yml_file_spec.rb b/spec/models/cmtool/yml_file_spec.rb
new file mode 100644
index 0000000..16f2d96
--- /dev/null
+++ b/spec/models/cmtool/yml_file_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe Cmtool::YmlFile do
+ describe ".all_as_object" do
+ it "combines the files using deep merge" do
+ described_class.create body: <<-YML.strip_heredoc
+ nl:
+ android:
+ link: l
+ YML
+ described_class.create body: <<-YML.strip_heredoc
+ nl:
+ android:
+ title: Mozo at Play store
+ YML
+
+ result = described_class.all_as_object
+ result.should =~ {
+ "nl"=> {
+ "android" => {
+ "title"=>"Mozo at Play store",
+ "link"=>"l"
+ }
+ }
+ }
+ end
+ end
+end