Skip to content
Newer
Older
100644 73 lines (58 sloc) 1.97 KB
6a31e65 @mojombo Tests and specs run under 1.9.
mojombo authored Apr 24, 2011
1 require 'helper'
b45fd65 @remi added tests to confirm that {{ site.posts }} in index.html was empty …
remi authored Dec 23, 2008
2
3 class TestGeneratedSite < Test::Unit::TestCase
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 5, 2009
4 context "generated sites" do
5 setup do
6 clear_dest
c60be9c @qrush Stubbing out the configuration makes for much less warnings.
qrush authored Mar 17, 2009
7 stub(Jekyll).configuration do
8 Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
9 end
10
11 @site = Site.new(Jekyll.configuration)
d602600 Fixed test_generated_site.
Josh Nichols and Nick Quaranto authored Mar 17, 2009
12 @site.process
479d8c7 @qrush Allowing the dest_dir and source_dir helpers to take arguments so tes…
qrush authored Mar 17, 2009
13 @index = File.read(dest_dir('index.html'))
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
14 end
b45fd65 @remi added tests to confirm that {{ site.posts }} in index.html was empty …
remi authored Dec 23, 2008
15
5ea06f3 @krisb fixes issue #78, including comprehensive scenarios and tests
krisb authored Jan 4, 2010
16 should "ensure post count is as expected" do
e4a2319 @krisb added tests to show how date and tags can end up having the wrong val…
krisb authored Jan 16, 2010
17 assert_equal 26, @site.posts.size
5ea06f3 @krisb fixes issue #78, including comprehensive scenarios and tests
krisb authored Jan 4, 2010
18 end
19
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
20 should "insert site.posts into the index" do
d602600 Fixed test_generated_site.
Josh Nichols and Nick Quaranto authored Mar 18, 2009
21 assert @index.include?("#{@site.posts.size} Posts")
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
22 end
efdd5ef @qrush Making sure that posts flagged as published: false don't get rendered…
qrush authored Feb 2, 2009
23
150ff1e @qrush Fixed small bug in test_generated_site and updating history with late…
qrush authored Jun 23, 2009
24 should "render latest post's content" do
25 assert @index.include?(@site.posts.last.content)
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
26 end
27
28 should "hide unpublished posts" do
479d8c7 @qrush Allowing the dest_dir and source_dir helpers to take arguments so tes…
qrush authored Mar 18, 2009
29 published = Dir[dest_dir('publish_test/2008/02/02/*.html')].map {|f| File.basename(f)}
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
30
31 assert_equal 1, published.size
32 assert_equal "published.html", published.first
33 end
992c4a8 @bdimcheff prevented _posts from being copied to the destination directory
bdimcheff authored Mar 4, 2009
34
18b512a Merge branch 'qrush/shoulda' into can_has_good_tests
Josh Nichols and Nick Quaranto authored Mar 17, 2009
35 should "not copy _posts directory" do
479d8c7 @qrush Allowing the dest_dir and source_dir helpers to take arguments so tes…
qrush authored Mar 18, 2009
36 assert !File.exist?(dest_dir('_posts'))
18b512a Merge branch 'qrush/shoulda' into can_has_good_tests
Josh Nichols and Nick Quaranto authored Mar 18, 2009
37 end
ee0167d @eugenebolshakov Made pages respect permalinks style and permalinks in yml front matter
eugenebolshakov authored May 8, 2009
38
39 should "process other static files and generate correct permalinks" do
40 assert File.exists?(dest_dir('/about/index.html'))
41 assert File.exists?(dest_dir('/contacts.html'))
42 end
992c4a8 @bdimcheff prevented _posts from being copied to the destination directory
bdimcheff authored Mar 4, 2009
43 end
f688c9d @cblunt Added limit-posts option to site configuration.
cblunt authored Sep 13, 2010
44
45 context "generating limited posts" do
46 setup do
47 clear_dest
48 stub(Jekyll).configuration do
49 Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5})
50 end
51
52 @site = Site.new(Jekyll.configuration)
53 @site.process
54 @index = File.read(dest_dir('index.html'))
55 end
56
57 should "generate only the specified number of posts" do
58 assert_equal 5, @site.posts.size
59 end
60
61 should "ensure limit posts is 1 or more" do
62 assert_raise ArgumentError do
63 clear_dest
64 stub(Jekyll).configuration do
65 Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0})
66 end
67
68 @site = Site.new(Jekyll.configuration)
69 end
70 end
71 end
b45fd65 @remi added tests to confirm that {{ site.posts }} in index.html was empty …
remi authored Dec 23, 2008
72 end
Something went wrong with that request. Please try again.