test/test_generated_site.rb in jekyll-0.7.0 vs test/test_generated_site.rb in jekyll-0.8.0

- old
+ new

@@ -39,6 +39,34 @@ should "process other static files and generate correct permalinks" do assert File.exists?(dest_dir('/about/index.html')) assert File.exists?(dest_dir('/contacts.html')) end end + + context "generating limited posts" do + setup do + clear_dest + stub(Jekyll).configuration do + Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5}) + end + + @site = Site.new(Jekyll.configuration) + @site.process + @index = File.read(dest_dir('index.html')) + end + + should "generate only the specified number of posts" do + assert_equal 5, @site.posts.size + end + + should "ensure limit posts is 1 or more" do + assert_raise ArgumentError do + clear_dest + stub(Jekyll).configuration do + Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) + end + + @site = Site.new(Jekyll.configuration) + end + end + end end