@@ -149,31 +149,30 @@ describe('saveData function', function() {
149149
150150describe ( 'checkForBower function' , function ( ) {
151151 it ( 'should return true if bower is installed' , function ( ) {
152- spyOn ( childProcess , 'exec' ) . andReturn ( {
153- output : '0'
154- } ) ;
152+ spyOn ( childProcess , 'execSync' ) . andReturn ( '1.7.9\n' ) ;
153+ var result = bowerUtils . checkForBower ( ) ;
154+ expect ( result ) . toEqual ( true ) ;
155+ } ) ;
156+ it ( 'should return true if bower is installed' , function ( ) {
157+ spyOn ( childProcess , 'execSync' ) . andReturn ( '0' ) ;
155158 var result = bowerUtils . checkForBower ( ) ;
156159 expect ( result ) . toEqual ( true ) ;
157160 } ) ;
158161
159162 it ( 'should return false if bower exec returns "command not found"' , function ( ) {
160- spyOn ( childProcess , 'exec' ) . andReturn ( {
161- output : 'command not found'
162- } ) ;
163+ spyOn ( childProcess , 'execSync' ) . andReturn ( 'command not found' ) ;
163164 var result = bowerUtils . checkForBower ( ) ;
164165 expect ( result ) . toEqual ( false ) ;
165166 } ) ;
166167
167168 it ( 'should return false if bower exec returns "not recognized"' , function ( ) {
168- spyOn ( childProcess , 'exec' ) . andReturn ( {
169- output : 'not recognized'
170- } ) ;
169+ spyOn ( childProcess , 'execSync' ) . andReturn ( 'not recognized' ) ;
171170 var result = bowerUtils . checkForBower ( ) ;
172171 expect ( result ) . toEqual ( false ) ;
173172 } ) ;
174173
175174 it ( 'should return false if bower exec throws an error' , function ( ) {
176- spyOn ( childProcess , 'exec ' ) . andCallFake ( function ( ) {
175+ spyOn ( childProcess , 'execSync ' ) . andCallFake ( function ( ) {
177176 throw new Error ( 'something happened' ) ;
178177 } ) ;
179178 var result = bowerUtils . checkForBower ( ) ;
0 commit comments