@@ -14,36 +14,42 @@ class TestJekyllArchives < Minitest::Test
14
14
15
15
should "generate archive pages by year" do
16
16
@archives . generate ( @site )
17
+
17
18
assert archive_exists? @site , "2014/index.html"
18
19
assert archive_exists? @site , "2013/index.html"
19
20
end
20
21
21
22
should "generate archive pages by month" do
22
23
@archives . generate ( @site )
24
+
23
25
assert archive_exists? @site , "2014/08/index.html"
24
26
assert archive_exists? @site , "2014/03/index.html"
25
27
end
26
28
27
29
should "generate archive pages by day" do
28
30
@archives . generate ( @site )
31
+
29
32
assert archive_exists? @site , "2014/08/17/index.html"
30
33
assert archive_exists? @site , "2013/08/16/index.html"
31
34
end
32
35
33
36
should "generate archive pages by tag" do
34
37
@archives . generate ( @site )
38
+
35
39
assert archive_exists? @site , "tag/test-tag/index.html"
36
40
assert archive_exists? @site , "tag/tagged/index.html"
37
41
assert archive_exists? @site , "tag/new/index.html"
38
42
end
39
43
40
44
should "generate archive pages by category" do
41
45
@archives . generate ( @site )
46
+
42
47
assert archive_exists? @site , "category/plugins/index.html"
43
48
end
44
49
45
50
should "generate archive pages with a layout" do
46
51
@site . process
52
+
47
53
assert_equal "Test" , read_file ( "tag/test-tag/index.html" )
48
54
end
49
55
end
@@ -62,6 +68,7 @@ class TestJekyllArchives < Minitest::Test
62
68
63
69
should "generate slugs using the mode specified" do
64
70
@archives . generate ( @site )
71
+
65
72
assert archive_exists? @site , "category/💎/index.html"
66
73
end
67
74
end
@@ -77,6 +84,7 @@ class TestJekyllArchives < Minitest::Test
77
84
78
85
should "use custom layout" do
79
86
@site . process
87
+
80
88
assert_equal "Test too" , read_file ( "tag/test-tag/index.html" )
81
89
end
82
90
end
@@ -164,10 +172,10 @@ class TestJekyllArchives < Minitest::Test
164
172
end
165
173
166
174
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" )
171
179
end
172
180
end
173
181
@@ -186,25 +194,25 @@ class TestJekyllArchives < Minitest::Test
186
194
end
187
195
188
196
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
191
199
end
192
200
193
201
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
197
205
end
198
206
199
207
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
202
210
end
203
211
204
212
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
208
216
end
209
217
end
210
218
@@ -215,6 +223,7 @@ class TestJekyllArchives < Minitest::Test
215
223
site . read
216
224
site . generate
217
225
end
226
+
218
227
assert_includes output , "Archives: Expected a hash but got [\" apples\" , \" oranges\" ]"
219
228
assert_includes output , "Archives will not be generated for this site."
220
229
@@ -223,6 +232,7 @@ class TestJekyllArchives < Minitest::Test
223
232
site . read
224
233
site . generate
225
234
end
235
+
226
236
assert_includes output , "Archives: Expected a hash but got nil"
227
237
assert_includes output , "Archives will not be generated for this site."
228
238
end
@@ -232,6 +242,7 @@ class TestJekyllArchives < Minitest::Test
232
242
site = fixture_site ( "jekyll-archives" => nil )
233
243
site . read
234
244
site . generate
245
+
235
246
assert_nil ( site . pages . find { |p | p . is_a? ( Jekyll ::Archives ::Archive ) } )
236
247
end
237
248
end
@@ -242,6 +253,7 @@ class TestJekyllArchives < Minitest::Test
242
253
@site . read
243
254
@site . generate
244
255
end
256
+
245
257
refute_includes output , "Archives: Expected a hash but got nil"
246
258
assert_nil ( @site . pages . find { |p | p . is_a? ( Jekyll ::Archives ::Archive ) } )
247
259
end
0 commit comments