33class TestJekyllArchives < Minitest ::Test
44 context "the jekyll-archives plugin" do
55 setup do
6- @site = fixture_site
6+ @site = fixture_site ( {
7+ "jekyll-archives" => {
8+ "enabled" => true
9+ }
10+ } )
711 @site . read
812 @archives = Jekyll ::Archives . new ( @site . config )
913 end
@@ -48,7 +52,8 @@ class TestJekyllArchives < Minitest::Test
4852 setup do
4953 @site = fixture_site ( {
5054 "jekyll-archives" => {
51- "layout" => "archive-too"
55+ "layout" => "archive-too" ,
56+ "enabled" => true
5257 }
5358 } )
5459 @site . read
@@ -65,6 +70,7 @@ class TestJekyllArchives < Minitest::Test
6570 setup do
6671 @site = fixture_site ( {
6772 "jekyll-archives" => {
73+ "enabled" => true ,
6874 "permalinks" => {
6975 "year" => "/year/:year/" ,
7076 "tag" => "/tag-:name.html" ,
@@ -86,12 +92,51 @@ class TestJekyllArchives < Minitest::Test
8692
8793 context "the archives" do
8894 setup do
89- @site = fixture_site
95+ @site = fixture_site ( {
96+ "jekyll-archives" => {
97+ "enabled" => true
98+ }
99+ } )
90100 @site . process
91101 end
92102
93103 should "populate the {{ site.archives }} tag in Liquid" do
94104 assert_equal 12 , read_file ( "/length.html" ) . to_i
95105 end
96106 end
107+
108+ context "the jekyll-archives plugin with default config" do
109+ setup do
110+ @site = fixture_site
111+ @site . process
112+ end
113+
114+ should "not generate any archives" do
115+ assert_equal 0 , read_file ( "/length.html" ) . to_i
116+ end
117+ end
118+
119+ context "the jekyll-archives plugin with enabled array" do
120+ setup do
121+ @site = fixture_site ( {
122+ "jekyll-archives" => {
123+ "enabled" => [ "tags" ]
124+ }
125+ } )
126+ @site . process
127+ end
128+
129+ should "generate the enabled archives" do
130+ assert archive_exists? @site , "/tag/test-tag/"
131+ assert archive_exists? @site , "/tag/tagged/"
132+ assert archive_exists? @site , "/tag/new/"
133+ end
134+
135+ should "not generate the disabled archives" do
136+ assert !archive_exists? ( @site , "/2014/" )
137+ assert !archive_exists? ( @site , "/2014/08/" )
138+ assert !archive_exists? ( @site , "/2013/08/16/" )
139+ assert !archive_exists? ( @site , "/category/plugins/" )
140+ end
141+ end
97142end
0 commit comments