4
4
var path = require ( "path" ) ;
5
5
var helpers = require ( "yeoman-generator" ) . test ;
6
6
var assert = require ( "yeoman-generator" ) . assert ;
7
- var tasks = require ( "../test-util.js" ) ;
8
7
9
8
describe ( "Jekyllized generator" , function ( ) {
10
9
describe ( "test for Jekyll settings" , function ( ) {
@@ -44,64 +43,39 @@ describe("Jekyllized generator", function () {
44
43
} ) ;
45
44
46
45
it ( "gulpfile.js does NOT contain a deploy task" , function ( ) {
47
- assert . noFileContent ( "gulpfile.js" , / g u l p .t a s k \( " d e p l o y " \) / ) ;
46
+ assert . noFileContent ( "gulpfile.js" , / g u l p .t a s k \( \ "d e p l o y \" / ) ;
48
47
} ) ;
49
48
50
- it ( "_config.yml contains the correct title" , function ( done ) {
51
- tasks . assertJekyllSettings ( this . jekyllized , "title" , "Mocha Test" , done ) ;
52
- } ) ;
53
-
54
- it ( "_config.yml contains the correct description" , function ( done ) {
55
- tasks . assertJekyllSettings ( this . jekyllized , "description" , "Mocha tests for Jekyllized" , done ) ;
56
- } ) ;
57
-
58
- it ( "_config.yml contains the correct tagline" , function ( done ) {
59
- tasks . assertJekyllSettings ( this . jekyllized , "tagline" , "Better hope this doesn\"t blow up" , done ) ;
60
- } ) ;
61
-
62
- it ( "_config.yml contains the correct author name" , function ( done ) {
63
- tasks . assertJekyllSettings ( this . jekyllized , "name" , "Ola Nordmann" , done ) ;
64
- } ) ;
65
-
66
- it ( "_config.yml contains the correct author email" , function ( done ) {
67
- tasks . assertJekyllSettings ( this . jekyllized , "email" , "ola.nordmann@email.com" , done ) ;
68
- } ) ;
69
-
70
- it ( "_config.yml contains the correct author bio" , function ( done ) {
71
- tasks . assertJekyllSettings ( this . jekyllized , "bio" , "Just your average Norwegian" , done ) ;
72
- } ) ;
73
-
74
- it ( "_config.yml contains the correct author Twitter" , function ( done ) {
75
- tasks . assertJekyllSettings ( this . jekyllized , "twitter" , "olanordmann123123" , done ) ;
76
- } ) ;
77
-
78
- it ( "_config.build.yml contains the corrent setting for future posts" , function ( done ) {
79
- tasks . assertJekyllBuildSettings ( this . jekyllized , "future" , "false" , done ) ;
80
- } ) ;
81
-
82
- it ( "_config.build.yml contains the corrent setting for drafts" , function ( done ) {
83
- tasks . assertJekyllBuildSettings ( this . jekyllized , "show_drafts" , "false" , done ) ;
84
- } ) ;
85
-
86
- it ( "_config.build.yml contains the corrent setting for LSI" , function ( done ) {
87
- tasks . assertJekyllBuildSettings ( this . jekyllized , "lsi" , "true" , done ) ;
88
- } ) ;
49
+ it ( "_config.yml contains the correct settings" , function ( ) {
50
+ var expected = [
51
+ [ "_config.yml" , / t i t l e \: M o c h a T e s t / ] ,
52
+ [ "_config.yml" , / d e s c r i p t i o n \: M o c h a t e s t s f o r J e k y l l i z e d / ] ,
53
+ [ "_config.yml" , / t a g l i n e \: B e t t e r h o p e t h i s d o e s n \" t b l o w u p / ] ,
54
+ [ "_config.yml" , / n a m e \: O l a N o r d m a n n / ] ,
55
+ [ "_config.yml" , / e m a i l \: o l a \. n o r d m a n n \@ e m a i l \. c o m / ] ,
56
+ [ "_config.yml" , / b i o \: J u s t y o u r a v e r a g e N o r w e g i a n / ] ,
57
+ [ "_config.yml" , / t w i t t e r \: o l a n o r d m a n n 1 2 3 1 2 3 / ]
58
+ ] ;
89
59
90
- it ( "_config.build.yml contains the corrent setting for limiting posts" , function ( done ) {
91
- tasks . assertJekyllBuildSettings ( this . jekyllized , "limit_posts" , "0" , done ) ;
60
+ assert . fileContent ( expected ) ;
92
61
} ) ;
93
62
94
- it ( "_config.build.yml contains the corrent setting for source dir" , function ( done ) {
95
- tasks . assertJekyllBuildSettings ( this . jekyllized , "source" , "src" , done ) ;
96
- } ) ;
63
+ it ( "_config.build.yml contains the correct settings" , function ( ) {
64
+ var expected = [
65
+ [ "_config.build.yml" , / f u t u r e \: f a l s e / ] ,
66
+ [ "_config.build.yml" , / s h o w _ d r a f t s \: f a l s e / ] ,
67
+ [ "_config.build.yml" , / l s i \: t r u e / ] ,
68
+ [ "_config.build.yml" , / l i m i t _ p o s t s \: 0 / ] ,
69
+ [ "_config.build.yml" , / s o u r c e \: s r c / ] ,
70
+ [ "_config.build.yml" , / d e s t i n a t i o n \: d i s t / ]
71
+ ] ;
97
72
98
- it ( "_config.build.yml contains the corrent setting for destination dir" , function ( done ) {
99
- tasks . assertJekyllBuildSettings ( this . jekyllized , "destination" , "dist" , done ) ;
73
+ assert . fileContent ( expected ) ;
100
74
} ) ;
101
75
102
76
} ) ;
103
77
104
- describe ( "test pretty permalinks and 10 pages " , function ( ) {
78
+ describe ( "test with setting pretty permalinks and 10 posts per page " , function ( ) {
105
79
before ( function ( done ) {
106
80
helpers . run ( path . join ( __dirname , "../app" ) )
107
81
. inDir ( path . join ( __dirname , "./temp/test-jekyll-pagination" ) )
@@ -114,17 +88,17 @@ describe("Jekyllized generator", function () {
114
88
. on ( "end" , done ) ;
115
89
} ) ;
116
90
117
- it ( "_config.yml permalink setting is 'pretty'" , function ( done ) {
118
- tasks . assertJekyllSettings ( this . jekyllized , " permalink" , " pretty" , done ) ;
91
+ it ( "_config.yml permalink setting is 'pretty'" , function ( ) {
92
+ assert . fileContent ( "_config.yml" , / p e r m a l i n k \: p r e t t y / ) ;
119
93
} ) ;
120
94
121
- it ( "_config.yml pagination setting is '10'" , function ( done ) {
122
- tasks . assertJekyllSettings ( this . jekyllized , " paginate" , "10" , done ) ;
95
+ it ( "_config.yml pagination is '10' posts per page " , function ( ) {
96
+ assert . fileContent ( "_config.yml" , / p a g i n a t e \: 1 0 / ) ;
123
97
} ) ;
124
98
125
99
} ) ;
126
100
127
- describe ( "test date permalinks and all pages " , function ( ) {
101
+ describe ( "test with setting date permalinks and all posts on the same page " , function ( ) {
128
102
before ( function ( done ) {
129
103
helpers . run ( path . join ( __dirname , "../app" ) )
130
104
. inDir ( path . join ( __dirname , "./temp/test-jekyll-pagination-1" ) )
@@ -137,17 +111,17 @@ describe("Jekyllized generator", function () {
137
111
. on ( "end" , done ) ;
138
112
} ) ;
139
113
140
- it ( "_config.yml permalink setting is 'date'" , function ( done ) {
141
- tasks . assertJekyllSettings ( this . jekyllized , " permalink" , " date" , done ) ;
114
+ it ( "_config.yml permalink setting is 'date'" , function ( ) {
115
+ assert . fileContent ( "_config.yml" , / p e r m a l i n k \: d a t e / ) ;
142
116
} ) ;
143
117
144
- it ( "_config.yml pagination setting is 'all'" , function ( done ) {
145
- tasks . assertJekyllSettings ( this . jekyllized , " paginate" , " all" , done ) ;
118
+ it ( "_config.yml pagination is 'all' posts per page " , function ( ) {
119
+ assert . fileContent ( "_config.yml" , / p a g i n a t e \: a l l / ) ;
146
120
} ) ;
147
121
148
122
} ) ;
149
123
150
- describe ( "test no permalinks and 1 page" , function ( ) {
124
+ describe ( "test with no permalinks setting and 1 post per page" , function ( ) {
151
125
before ( function ( done ) {
152
126
helpers . run ( path . join ( __dirname , "../app" ) )
153
127
. inDir ( path . join ( __dirname , "./temp/test-jekyll-pagination-2" ) )
@@ -160,12 +134,12 @@ describe("Jekyllized generator", function () {
160
134
. on ( "end" , done ) ;
161
135
} ) ;
162
136
163
- it ( "_config.yml permalink setting is 'none'" , function ( done ) {
164
- tasks . assertJekyllSettings ( this . jekyllized , " permalink" , " none" , done ) ;
137
+ it ( "_config.yml permalink setting is 'none'" , function ( ) {
138
+ assert . fileContent ( "_config.yml" , / p e r m a l i n k \: n o n e / ) ;
165
139
} ) ;
166
140
167
- it ( "_config.yml pagination setting is '1'" , function ( done ) {
168
- tasks . assertJekyllSettings ( this . jekyllized , " paginate" , "1" , done ) ;
141
+ it ( "_config.yml pagination is '1' posts per page " , function ( ) {
142
+ assert . fileContent ( "_config.yml" , / p a g i n a t e \: 1 / ) ;
169
143
} ) ;
170
144
171
145
} ) ;
0 commit comments