utils/drops: update Drop to support Utils.deep_merge_hashes

Fixes #4287
This commit is contained in:
Parker Moore
2015-12-27 08:06:37 -05:00
parent 69a6323599
commit 5bf596b239
4 changed files with 42 additions and 14 deletions

View File

@@ -4,15 +4,25 @@ class TestUtils < JekyllUnitTest
context "The \`Utils.deep_merge_hashes\` method" do
setup do
clear_dest
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
@site = fixture_site(config)
@site = fixture_site
@site.process
end
should "merge a page into the site" do
should "merge a drop into a hash" do
data = {"page" => {}}
assert Utils.deep_merge_hashes(data, @site.site_payload)
merged = Utils.deep_merge_hashes(data, @site.site_payload)
assert merged.is_a? Hash
assert merged["site"].is_a? Drops::SiteDrop
assert_equal data["page"], {}
end
should "merge a hash into a drop" do
data = {"page" => {}}
assert_nil @site.site_payload["page"]
merged = Utils.deep_merge_hashes(@site.site_payload, data)
assert merged.is_a? Drops::UnifiedPayloadDrop
assert merged["site"].is_a? Drops::SiteDrop
assert_equal data["page"], {}
end
end