@@ -111,6 +111,24 @@ describe('plugin command', function() {
111111 } ) ;
112112 } ) ;
113113
114+ it ( 'should add array of variables' , function ( done ) {
115+ var processArguments = [ 'node' , 'ionic' , 'plugin' , 'add' , 'thing' , '--variable' , 'hello' , '--variable' , 'man' ] ;
116+ var rawCliArguments = processArguments . slice ( 2 ) ;
117+ var argv = optimist ( rawCliArguments ) . argv ;
118+
119+ spyOn ( State , 'savePlugin' ) ;
120+ spyOn ( State , 'removePlugin' ) ;
121+ spyOn ( cordovaUtils , 'execCordovaCommand' ) . andReturn ( Q ( 0 ) ) ;
122+
123+ plugin . run ( null , argv , rawCliArguments ) . then ( function ( ) {
124+ expect ( cordovaUtils . execCordovaCommand ) . toHaveBeenCalledWith (
125+ [ 'plugin' , 'add' , 'thing' , '--variable' , 'hello' , '--variable' , 'man' ] ) ;
126+ expect ( State . savePlugin ) . toHaveBeenCalledWith ( appDirectory , 'thing' , [ 'hello' , 'man' ] ) ;
127+ expect ( State . removePlugin ) . not . toHaveBeenCalled ( ) ;
128+ done ( ) ;
129+ } ) ;
130+ } ) ;
131+
114132 it ( 'should add plugins' , function ( done ) {
115133 var processArguments = [ 'node' , 'ionic' , 'plugin' , 'add' , 'thing' , '--variable' , 'hello' ] ;
116134 var rawCliArguments = processArguments . slice ( 2 ) ;
0 commit comments