Remove to_i. Let commander gem do it #1004

This commit is contained in:
uu59 2013-04-29 15:51:37 +09:00
parent 20a837d15c
commit 94756340cd
3 changed files with 3 additions and 14 deletions

View File

@ -48,7 +48,7 @@ command :build do |c|
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option '--future', 'Publishes posts with a future date'
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '--drafts', 'Render posts in the _drafts folder'
@ -66,7 +66,7 @@ command :serve do |c|
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option '--future', 'Publishes posts with a future date'
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '--drafts', 'Render posts in the _drafts folder'

View File

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

View File

@ -68,15 +68,5 @@ class TestGeneratedSite < Test::Unit::TestCase
@site = Site.new(Jekyll.configuration)
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