Merge pull request #5060 from stomar/stringify-overrides

Merge pull request 5060
This commit is contained in:
jekyllbot 2016-07-15 17:26:14 -07:00 committed by GitHub
commit eb88aa330c
2 changed files with 13 additions and 0 deletions

View File

@ -101,6 +101,7 @@ module Jekyll
# Returns the final configuration Hash.
def configuration(override = {})
config = Configuration.new
override = Configuration[override].stringify_keys
unless override.delete("skip_config_files")
config = config.read_config_files(config.config_files(override))
end

View File

@ -334,6 +334,18 @@ class TestConfiguration < JekyllUnitTest
Jekyll.configuration(test_config.merge({ "config" => @paths[:other] }))
end
should "load different config if specified with symbol key" do
allow(SafeYAML).to receive(:load_file).with(@paths[:default]).and_return({})
allow(SafeYAML)
.to receive(:load_file)
.with(@paths[:other])
.and_return({ "baseurl" => "http://example.com" })
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}")
assert_equal \
site_configuration({ "baseurl" => "http://example.com" }),
Jekyll.configuration(test_config.merge({ :config => @paths[:other] }))
end
should "load default config if path passed is empty" do
allow(SafeYAML).to receive(:load_file).with(@paths[:default]).and_return({})
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:default]}")