@@ -44,17 +44,33 @@ describe('Acceptance: ng generate directive', function () {
44
44
it ( 'my-dir --flat false' , function ( ) {
45
45
const appRoot = path . join ( root , 'tmp/foo' ) ;
46
46
const testPath = path . join ( appRoot , 'src/app/my-dir/my-dir.directive.ts' ) ;
47
+ const testSpecPath = path . join ( appRoot , 'src/app/my-dir/my-dir.directive.spec.ts' ) ;
47
48
const appModulePath = path . join ( appRoot , 'src/app/app.module.ts' ) ;
48
49
49
50
return ng ( [ 'generate' , 'directive' , 'my-dir' , '--flat' , 'false' ] )
50
- . then ( ( ) => expect ( existsSync ( testPath ) ) . to . equal ( true ) )
51
+ . then ( ( ) => {
52
+ expect ( existsSync ( testPath ) ) . to . equal ( true ) ;
53
+ expect ( existsSync ( testSpecPath ) ) . to . equal ( true ) ;
54
+ } )
51
55
. then ( ( ) => readFile ( appModulePath , 'utf-8' ) )
52
56
. then ( content => {
53
57
expect ( content ) . matches ( / i m p o r t .* \b M y D i r D i r e c t i v e \b .* f r o m ' .\/ m y - d i r \/ m y - d i r .d i r e c t i v e ' ; / ) ;
54
58
expect ( content ) . matches ( / d e c l a r a t i o n s : \s * \[ [ ^ \] ] + ?, \r ? \n \s + M y D i r D i r e c t i v e \r ? \n / m) ;
55
59
} ) ;
56
60
} ) ;
57
61
62
+ it ( 'my-dir --flat false --no-spec' , function ( ) {
63
+ const appRoot = path . join ( root , 'tmp/foo' ) ;
64
+ const testPath = path . join ( appRoot , 'src/app/my-dir/my-dir.directive.ts' ) ;
65
+ const testSpecPath = path . join ( appRoot , 'src/app/my-dir/my-dir.directive.spec.ts' ) ;
66
+
67
+ return ng ( [ 'generate' , 'directive' , 'my-dir' , '--flat' , 'false' , '--no-spec' ] )
68
+ . then ( ( ) => {
69
+ expect ( existsSync ( testPath ) ) . to . equal ( true ) ;
70
+ expect ( existsSync ( testSpecPath ) ) . to . equal ( false ) ;
71
+ } ) ;
72
+ } ) ;
73
+
58
74
it ( 'test' + path . sep + 'my-dir' , function ( ) {
59
75
fs . mkdirsSync ( path . join ( root , 'tmp' , 'foo' , 'src' , 'app' , 'test' ) ) ;
60
76
return ng ( [ 'generate' , 'directive' , 'test' + path . sep + 'my-dir' , '--flat' , 'false' ] ) . then ( ( ) => {
0 commit comments