Fixing tests, and making it more ruby friendly
This commit is contained in:
parent
1e209c9bf3
commit
14a669530e
|
@ -138,7 +138,7 @@ module Jekyll
|
||||||
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
||||||
config_files = override.delete('config')
|
config_files = override.delete('config')
|
||||||
config_files = File.join(source, "_config.yml") if config_files.to_s.empty?
|
config_files = File.join(source, "_config.yml") if config_files.to_s.empty?
|
||||||
if not config_files.is_a? Array
|
unless config_files.is_a? Array
|
||||||
config_files = [config_files]
|
config_files = [config_files]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,12 @@ class TestConfiguration < Test::Unit::TestCase
|
||||||
assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] })
|
assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "load default config if path passed is empty" do
|
||||||
|
mock(YAML).safe_load_file(@paths[:default]) { Hash.new }
|
||||||
|
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
||||||
|
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] })
|
||||||
|
end
|
||||||
|
|
||||||
should "load multiple config files" do
|
should "load multiple config files" do
|
||||||
mock(YAML).safe_load_file(@paths[:default]) { Hash.new }
|
mock(YAML).safe_load_file(@paths[:default]) { Hash.new }
|
||||||
mock(YAML).safe_load_file(@paths[:other]) { Hash.new }
|
mock(YAML).safe_load_file(@paths[:other]) { Hash.new }
|
||||||
|
|
Loading…
Reference in New Issue