44var path = require ( "path" ) ;
55var helpers = require ( "yeoman-generator" ) . test ;
66var assert = require ( "yeoman-generator" ) . assert ;
7- var tasks = require ( "../test-util.js" ) ;
87
98describe ( "Jekyllized generator" , function ( ) {
109 describe ( "test for Jekyll settings" , function ( ) {
@@ -44,64 +43,39 @@ describe("Jekyllized generator", function () {
4443 } ) ;
4544
4645 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 \" / ) ;
4847 } ) ;
4948
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+ ] ;
8959
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 ) ;
9261 } ) ;
9362
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+ ] ;
9772
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 ) ;
10074 } ) ;
10175
10276 } ) ;
10377
104- describe ( "test pretty permalinks and 10 pages " , function ( ) {
78+ describe ( "test with setting pretty permalinks and 10 posts per page " , function ( ) {
10579 before ( function ( done ) {
10680 helpers . run ( path . join ( __dirname , "../app" ) )
10781 . inDir ( path . join ( __dirname , "./temp/test-jekyll-pagination" ) )
@@ -114,17 +88,17 @@ describe("Jekyllized generator", function () {
11488 . on ( "end" , done ) ;
11589 } ) ;
11690
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 / ) ;
11993 } ) ;
12094
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 / ) ;
12397 } ) ;
12498
12599 } ) ;
126100
127- describe ( "test date permalinks and all pages " , function ( ) {
101+ describe ( "test with setting date permalinks and all posts on the same page " , function ( ) {
128102 before ( function ( done ) {
129103 helpers . run ( path . join ( __dirname , "../app" ) )
130104 . inDir ( path . join ( __dirname , "./temp/test-jekyll-pagination-1" ) )
@@ -137,17 +111,17 @@ describe("Jekyllized generator", function () {
137111 . on ( "end" , done ) ;
138112 } ) ;
139113
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 / ) ;
142116 } ) ;
143117
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 / ) ;
146120 } ) ;
147121
148122 } ) ;
149123
150- describe ( "test no permalinks and 1 page" , function ( ) {
124+ describe ( "test with no permalinks setting and 1 post per page" , function ( ) {
151125 before ( function ( done ) {
152126 helpers . run ( path . join ( __dirname , "../app" ) )
153127 . inDir ( path . join ( __dirname , "./temp/test-jekyll-pagination-2" ) )
@@ -160,12 +134,12 @@ describe("Jekyllized generator", function () {
160134 . on ( "end" , done ) ;
161135 } ) ;
162136
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 / ) ;
165139 } ) ;
166140
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 / ) ;
169143 } ) ;
170144
171145 } ) ;
0 commit comments