cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject [1/3] git commit: Fixed ios spec test to match moving some specific ios steps into a common module
Date Mon, 29 Apr 2013 22:52:21 GMT
Updated Branches:
  refs/heads/master 858a5c4ae -> 6c4c62e92


Fixed ios spec test to match moving some specific ios steps into a common module


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/6c4c62e9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/6c4c62e9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/6c4c62e9

Branch: refs/heads/master
Commit: 6c4c62e9266bc593df93ce28a0154653f7302e65
Parents: 38531af
Author: Tim Kim <timk@adobe.com>
Authored: Mon Apr 29 15:50:46 2013 -0700
Committer: Tim Kim <timk@adobe.com>
Committed: Mon Apr 29 15:51:59 2013 -0700

----------------------------------------------------------------------
 spec/platforms/ios.spec.js |   69 ++++----------------------------------
 1 files changed, 8 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/6c4c62e9/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index 187f640..591e217 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -5,6 +5,7 @@ var ios = require('../../src/platforms/ios'),
     et = require('elementtree'),
     shell = require('shelljs'),
     os = require('osenv'),
+    common = require('../../src/platforms/common'),
     xcode = require('xcode'),
     plist = require('plist'),
     bplist = require('bplist-parser'),
@@ -395,78 +396,24 @@ describe('ios project handler', function() {
             });
         });
 
-        describe('of <plugins-plist> elements', function() {
-            it('should only be used in an applicably old cordova-ios project', function(){
-                shell.cp('-rf', ios_plist_project, temp);
-                var pls = copyArray(plist_els);
-                var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
-                
-                ios.uninstall(pls, dummy_id, temp, dummyplugin);
-                expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist'));
-            });
-            it('should not be used in an applicably old cordova-ios project', function()
{
-                shell.cp('-rf', ios_config_xml_project, temp);
-                var pls = copyArray(plist_els);
-                var spy = spyOn(xml_helpers, 'parseElementtreeSync').andCallThrough();
-                ios.uninstall(pls, dummy_id, temp, dummyplugin);
-                expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'));
-            });
-            it('should remove the <plugin> element in applicably new cordova-ios projects
with old-style plugins using only <plugins-plist> elements', function() {
-                shell.cp('-rf', ios_config_xml_project, temp);
-                var pls = copyArray(plist_only_els);
-                //ios.install(pls, plist_id, temp, plistplugin, {});
-                var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
-                ios.uninstall(pls, dummy_id, temp, plistplugin);
-                expect(fs.readFileSync(path.join(temp, 'SampleApp', 'config.xml'), 'utf-8')).not.toMatch(/<plugin
name="OldSkewl"/gi);
-            });
-        });
-  
-        describe('of <config-file> elements', function() {
-            beforeEach(function() {
-                shell.cp('-rf', ios_config_xml_project, temp);
-            });
-            it('should call xml_helpers\' pruneXML', function(){
-                var config = copyArray(dummy_configs);
-                // add an extra child element to avoid an if statement in ios.js
-                config[0]._children[1] = config[0]._children[0];
-                
-                var spy = spyOn(xml_helpers, 'pruneXML').andReturn({config_path: ''});
-
-                ios.uninstall(config, dummy_id, temp, dummyplugin);
-                expect(spy).toHaveBeenCalledWith(jasmine.any(Object), dummy_configs[0]._children,
'/widget/plugins');                
-            });
-            it('should write the new config file out after successfully pruning', function(){
-                var config = copyArray(dummy_configs);
-                // add an extra child element to avoid an if statement in ios.js
-                config[0]._children[1] = config[0]._children[0];
-                
-                var spyPrune = spyOn(xml_helpers, 'pruneXML').andCallThrough();
-                var spyWrite = spyOn(fs, 'writeFileSync');
-
-                ios.uninstall(config, dummy_id, temp, dummyplugin);
-                expect(spyPrune).toHaveBeenCalled();
-                expect(spyWrite).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'config.xml'),
jasmine.any(String));    
-            });
-        });
-
         describe('of <asset> elements', function() {
             beforeEach(function() {
                 shell.cp('-rf', ios_config_xml_project, temp);
             });
             it('should call rm on specified asset',function(){
-                var config = copyArray(assets);
-                var spy = spyOn(shell, 'rm');
+                var config = copyArray(valid_assets);
+                var spy = spyOn(common, 'removeFile');
                 
                 ios.uninstall(config, dummy_id, temp, dummyplugin);
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'dummyplugin.js'));
   
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'dummyplugin'));
 
+                expect(spy).toHaveBeenCalledWith(path.join(temp, 'www'), 'dummyplugin.js');
   
+                expect(spy).toHaveBeenCalledWith(path.join(temp, 'www'), 'dummyplugin');
 
             });
             it('should call rm on the www/plugins/<plugin_id> folder',function(){
-                var config = copyArray(assets);
-                var spy = spyOn(shell, 'rm');
+                var config = copyArray(valid_assets);
+                var spy = spyOn(common, 'removeFile');
                 
                 ios.uninstall(config, dummy_id, temp, dummyplugin);
-                expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'www', 'plugins',
dummy_id));    
+                expect(spy).toHaveBeenCalledWith(path.join(temp, 'www', 'plugins'), dummy_id);
   
             });
         });
 


Mime
View raw message