File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,15 @@ def fixture_site(config = {})
3030 end
3131
3232 def archive_exists? ( site , path )
33- site . pages . any? { |archive | archive . path == path }
33+ site . config [ "archives" ] . any? { |archive | archive . path == path }
3434 end
3535
3636 def read_file ( path )
37- File . read ( File . join ( DEST_DIR , path ) ) . strip
37+ read_path = File . join ( DEST_DIR , path )
38+ if File . exist? read_path
39+ File . read ( read_path ) . strip
40+ else
41+ return false
42+ end
3843 end
3944end
Original file line number Diff line number Diff line change 1+ ---
2+ layout: null
3+ ---
4+ {{ site.archives.size }}
Original file line number Diff line number Diff line change @@ -60,17 +60,26 @@ class TestJekyllArchives < Minitest::Test
6060 }
6161 }
6262 } )
63- @site . read
64- @archives = Jekyll ::Archives . new ( @site . config )
63+ @site . process
6564 end
6665
6766 should "use the right permalink" do
68- @site . process
6967 assert archive_exists? @site , "/2014/"
7068 assert archive_exists? @site , "/2013/"
7169 assert archive_exists? @site , "/tag-test.html"
7270 assert archive_exists? @site , "/tag-new.html"
7371 assert archive_exists? @site , "/category-plugins.html"
7472 end
7573 end
74+
75+ context "the archives" do
76+ setup do
77+ @site = fixture_site
78+ @site . process
79+ end
80+
81+ should "populate the {{ site.archives }} tag in Liquid" do
82+ assert_equal 6 , read_file ( "/length.html" ) . to_i
83+ end
84+ end
7685end
You can’t perform that action at this time.
0 commit comments