Ensure theme config is a `Jekyll::Configuration` object (#8988)

Merge pull request 8988
This commit is contained in:
Ashwin Maroli 2022-04-08 14:43:21 +05:30 committed by GitHub
parent 0d0fd3f41b
commit 3b3f845846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -476,7 +476,11 @@ module Jekyll
theme_config.delete_if { |key, _| Configuration::DEFAULTS.key?(key) }
# Override theme_config with existing config and return the result.
# Additionally ensure we return a `Jekyll::Configuration` instance instead of a Hash.
Utils.deep_merge_hashes(theme_config, config)
.each_with_object(Jekyll::Configuration.new) do |(key, value), conf|
conf[key] = value
end
end
# Limits the current posts; removes the posts which exceed the limit_posts

View File

@ -97,6 +97,12 @@ class TestSite < JekyllUnitTest
)
end
should "load config file from theme-gem as Jekyll::Configuration instance" do
site = fixture_site("theme" => "test-theme")
assert_instance_of Jekyll::Configuration, site.config
assert_equal "Hello World", site.config["title"]
end
context "with a custom cache_dir configuration" do
should "have the custom cache_dir hidden from Git" do
site = fixture_site("cache_dir" => "../../custom-cache-dir")