Fix `jekyll serve --limit_posts n` failed

This commit is contained in:
uu59 2013-04-28 02:03:08 +09:00
parent 46ce757b71
commit ad2c706a34
2 changed files with 12 additions and 1 deletions

View File

@ -27,7 +27,8 @@ module Jekyll
self.include = config['include'] self.include = config['include']
self.future = config['future'] self.future = config['future']
self.show_drafts = config['show_drafts'] self.show_drafts = config['show_drafts']
self.limit_posts = config['limit_posts'] # given as String if it is came from CLI option
self.limit_posts = config['limit_posts'].nil? ? nil : config["limit_posts"].to_i
self.keep_files = config['keep_files'] self.keep_files = config['keep_files']
self.reset self.reset

View File

@ -68,5 +68,15 @@ class TestGeneratedSite < Test::Unit::TestCase
@site = Site.new(Jekyll.configuration) @site = Site.new(Jekyll.configuration)
end end
end end
should "ensure if limit_posts is a String (from CLI option)" do
clear_dest
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'limit_posts' => "3"})
end
@site = Site.new(Jekyll.configuration)
assert_equal 3, @site.limit_posts
end
end end
end end