Skip to content

Commit

Permalink
Merge commit '597c7a7904198d92aa5eacad356019165685c311'
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Jan 9, 2010
2 parents 4c1021d + 597c7a7 commit 473f3ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/jekyll.rb
Expand Up @@ -68,10 +68,10 @@ def self.configuration(override)
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

Expand Down
10 changes: 5 additions & 5 deletions test/test_configuration.rb
Expand Up @@ -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
Expand Down

0 comments on commit 473f3ff

Please sign in to comment.