@@ -14,36 +14,42 @@ class TestJekyllArchives < Minitest::Test
1414
1515 should "generate archive pages by year" do
1616 @archives . generate ( @site )
17+
1718 assert archive_exists? @site , "2014/index.html"
1819 assert archive_exists? @site , "2013/index.html"
1920 end
2021
2122 should "generate archive pages by month" do
2223 @archives . generate ( @site )
24+
2325 assert archive_exists? @site , "2014/08/index.html"
2426 assert archive_exists? @site , "2014/03/index.html"
2527 end
2628
2729 should "generate archive pages by day" do
2830 @archives . generate ( @site )
31+
2932 assert archive_exists? @site , "2014/08/17/index.html"
3033 assert archive_exists? @site , "2013/08/16/index.html"
3134 end
3235
3336 should "generate archive pages by tag" do
3437 @archives . generate ( @site )
38+
3539 assert archive_exists? @site , "tag/test-tag/index.html"
3640 assert archive_exists? @site , "tag/tagged/index.html"
3741 assert archive_exists? @site , "tag/new/index.html"
3842 end
3943
4044 should "generate archive pages by category" do
4145 @archives . generate ( @site )
46+
4247 assert archive_exists? @site , "category/plugins/index.html"
4348 end
4449
4550 should "generate archive pages with a layout" do
4651 @site . process
52+
4753 assert_equal "Test" , read_file ( "tag/test-tag/index.html" )
4854 end
4955 end
@@ -62,6 +68,7 @@ class TestJekyllArchives < Minitest::Test
6268
6369 should "generate slugs using the mode specified" do
6470 @archives . generate ( @site )
71+
6572 assert archive_exists? @site , "category/💎/index.html"
6673 end
6774 end
@@ -77,6 +84,7 @@ class TestJekyllArchives < Minitest::Test
7784
7885 should "use custom layout" do
7986 @site . process
87+
8088 assert_equal "Test too" , read_file ( "tag/test-tag/index.html" )
8189 end
8290 end
@@ -164,10 +172,10 @@ class TestJekyllArchives < Minitest::Test
164172 end
165173
166174 should "not generate the disabled archives" do
167- assert ! archive_exists? ( @site , "2014/index.html" )
168- assert ! archive_exists? ( @site , "2014/08/index.html" )
169- assert ! archive_exists? ( @site , "2013/08/16/index.html" )
170- assert ! archive_exists? ( @site , "category/plugins/index.html" )
175+ refute archive_exists? ( @site , "2014/index.html" )
176+ refute archive_exists? ( @site , "2014/08/index.html" )
177+ refute archive_exists? ( @site , "2013/08/16/index.html" )
178+ refute archive_exists? ( @site , "category/plugins/index.html" )
171179 end
172180 end
173181
@@ -186,25 +194,25 @@ class TestJekyllArchives < Minitest::Test
186194 end
187195
188196 should "populate the title field in case of category or tag" do
189- assert @tag_archive . title . is_a? String
190- assert @category_archive . title . is_a? String
197+ assert_kind_of String , @tag_archive . title
198+ assert_kind_of String , @category_archive . title
191199 end
192200
193201 should "use nil for the title field in case of dates" do
194- assert @year_archive . title . nil?
195- assert @month_archive . title . nil?
196- assert @day_archive . title . nil?
202+ assert_nil @year_archive . title
203+ assert_nil @month_archive . title
204+ assert_nil @day_archive . title
197205 end
198206
199207 should "use nil for the date field in case of category or tag" do
200- assert @tag_archive . date . nil?
201- assert @category_archive . date . nil?
208+ assert_nil @tag_archive . date
209+ assert_nil @category_archive . date
202210 end
203211
204212 should "populate the date field with a Date in case of dates" do
205- assert @year_archive . date . is_a? Date
206- assert @month_archive . date . is_a? Date
207- assert @day_archive . date . is_a? Date
213+ assert_kind_of Date , @year_archive . date
214+ assert_kind_of Date , @month_archive . date
215+ assert_kind_of Date , @day_archive . date
208216 end
209217 end
210218
@@ -215,6 +223,7 @@ class TestJekyllArchives < Minitest::Test
215223 site . read
216224 site . generate
217225 end
226+
218227 assert_includes output , "Archives: Expected a hash but got [\" apples\" , \" oranges\" ]"
219228 assert_includes output , "Archives will not be generated for this site."
220229
@@ -223,6 +232,7 @@ class TestJekyllArchives < Minitest::Test
223232 site . read
224233 site . generate
225234 end
235+
226236 assert_includes output , "Archives: Expected a hash but got nil"
227237 assert_includes output , "Archives will not be generated for this site."
228238 end
@@ -232,6 +242,7 @@ class TestJekyllArchives < Minitest::Test
232242 site = fixture_site ( "jekyll-archives" => nil )
233243 site . read
234244 site . generate
245+
235246 assert_nil ( site . pages . find { |p | p . is_a? ( Jekyll ::Archives ::Archive ) } )
236247 end
237248 end
@@ -242,6 +253,7 @@ class TestJekyllArchives < Minitest::Test
242253 @site . read
243254 @site . generate
244255 end
256+
245257 refute_includes output , "Archives: Expected a hash but got nil"
246258 assert_nil ( @site . pages . find { |p | p . is_a? ( Jekyll ::Archives ::Archive ) } )
247259 end
0 commit comments