creating a Site with an invalid Markdown processor fails sooner and gives a better error message

Signed-off-by: Nick Quaranto <nick@quaran.to>
This commit is contained in:
Gaius Novus 2009-05-29 21:39:17 -04:00 committed by Nick Quaranto
parent e0ceee2e89
commit 5468548948
3 changed files with 19 additions and 1 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
test/dest/
test/dest
*.gem
pkg/
*.swp

View File

@ -77,6 +77,8 @@ module Jekyll
rescue LoadError
puts "The maruku gem is required for markdown support!"
end
else
raise "Invalid Markdown processor: '#{self.config['markdown']}' -- did you mean 'maruku' or 'rdiscount'?"
end
end

View File

@ -65,5 +65,21 @@ class TestSite < Test::Unit::TestCase
@site.exclude = excludes
assert_equal includes, @site.filter_entries(excludes + includes)
end
context 'with an invalid markdown processor in the configuration' do
should 'give a meaningful error message' do
bad_processor = 'not a processor name'
begin
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
flunk 'Invalid markdown processors should cause a failure on site creation'
rescue RuntimeError => e
assert e.to_s =~ /invalid|bad/i
assert e.to_s =~ %r{#{bad_processor}}
end
end
end
end
end