Merge commit '597c7a7904198d92aa5eacad356019165685c311'
This commit is contained in:
commit
473f3ffc11
|
@ -68,10 +68,10 @@ module Jekyll
|
|||
begin
|
||||
config = YAML.load_file(config_file)
|
||||
raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash)
|
||||
STDOUT.puts "Configuration from #{config_file}"
|
||||
$stdout.puts "Configuration from #{config_file}"
|
||||
rescue => err
|
||||
STDERR.puts "WARNING: Could not read configuration. Using defaults (and options)."
|
||||
STDERR.puts "\t" + err.to_s
|
||||
$stderr.puts "WARNING: Could not read configuration. Using defaults (and options)."
|
||||
$stderr.puts "\t" + err.to_s
|
||||
config = {}
|
||||
end
|
||||
|
||||
|
|
|
@ -8,21 +8,21 @@ class TestConfiguration < Test::Unit::TestCase
|
|||
|
||||
should "fire warning with no _config.yml" do
|
||||
mock(YAML).load_file(@path) { raise "No such file or directory - #{@path}" }
|
||||
mock(STDERR).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
||||
mock(STDERR).puts("\tNo such file or directory - #{@path}")
|
||||
mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
||||
mock($stderr).puts("\tNo such file or directory - #{@path}")
|
||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
||||
end
|
||||
|
||||
should "load configuration as hash" do
|
||||
mock(YAML).load_file(@path) { Hash.new }
|
||||
mock(STDOUT).puts("Configuration from #{@path}")
|
||||
mock($stdout).puts("Configuration from #{@path}")
|
||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
||||
end
|
||||
|
||||
should "fire warning with bad config" do
|
||||
mock(YAML).load_file(@path) { Array.new }
|
||||
mock(STDERR).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
||||
mock(STDERR).puts("\tInvalid configuration - #{@path}")
|
||||
mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
||||
mock($stderr).puts("\tInvalid configuration - #{@path}")
|
||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue