Fix `jekyll serve --limit_posts n` failed
This commit is contained in:
parent
46ce757b71
commit
ad2c706a34
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue