cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [1/4] git commit: CB-7063 save.spec and restore.spec use a proper spy
Date Wed, 02 Jul 2014 19:37:00 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master fe873fd12 -> 3911876cd


CB-7063 save.spec and restore.spec use a proper spy


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/8c3885a4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/8c3885a4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/8c3885a4

Branch: refs/heads/master
Commit: 8c3885a452e1db5bdb03bdcfd58342d99bf8a9bf
Parents: fe873fd
Author: Josh Soref <jsoref@blackberry.com>
Authored: Wed Jul 2 14:55:40 2014 -0400
Committer: Josh Soref <jsoref@blackberry.com>
Committed: Wed Jul 2 15:12:22 2014 -0400

----------------------------------------------------------------------
 cordova-lib/spec-cordova/restore.spec.js | 29 +++++++++++----------------
 cordova-lib/spec-cordova/save.spec.js    | 21 +++++++++----------
 2 files changed, 22 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8c3885a4/cordova-lib/spec-cordova/restore.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/restore.spec.js b/cordova-lib/spec-cordova/restore.spec.js
index 1604d5d..0f3be83 100644
--- a/cordova-lib/spec-cordova/restore.spec.js
+++ b/cordova-lib/spec-cordova/restore.spec.js
@@ -17,11 +17,12 @@
     under the License.
 */
 
-var project_dir = path.join(__dirname, 'fixtures', 'base');
-
-var cordova = require('../src/cordova/cordova'),
+var path = require('path'),
+    Q = require('Q'),
+    cordova = require('../src/cordova/cordova'),
     cordova_util = require('../src/cordova/util'),
-    ConfigParser = require('../src/configparser/ConfigParser');
+    ConfigParser = require('../src/configparser/ConfigParser'),
+    project_dir = path.join(__dirname, 'fixtures', 'base');
 
 describe('restore command', function(){
   var is_cordova, result, config_add_feature, cd_project;
@@ -46,21 +47,15 @@ describe('restore command', function(){
      });
   });
 
-  it('should not try to restore featrues from config.xml', function(){
-
-
-   cd_project_root = spyOn(cordova_util, 'cdProjectRoot').andReturn(project_dir);
-
-    var call_count =0;
-    ConfigParser.prototype.write = function(){
-      call_count++;
-    }
-
-     expect(call_count).toEqual(0);
+  it('should not try to restore features from config.xml', function(){
 
-     cordova.restore('plugins');
 
-     expect(call_count).toEqual(0);
+    cd_project_root = spyOn(cordova_util, 'cdProjectRoot').andReturn(project_dir);
+    var parserWriter = spyOn(ConfigParser.prototype, 'write');
+    expect(ConfigParser.prototype.write).not.toHaveBeenCalled();
+    cordova.restore('plugins');
+    expect(ConfigParser.prototype.write).not.toHaveBeenCalled();
+    parserWriter.andCallThrough();
   });
 
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8c3885a4/cordova-lib/spec-cordova/save.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/save.spec.js b/cordova-lib/spec-cordova/save.spec.js
index 2386c43..001ebbc 100644
--- a/cordova-lib/spec-cordova/save.spec.js
+++ b/cordova-lib/spec-cordova/save.spec.js
@@ -17,11 +17,12 @@
     under the License.
 */
 
-var project_dir = path.join(__dirname, 'fixtures', 'base');
-
-var cordova = require('../src/cordova/cordova'),
+var path = require('path'),
+    Q = require('Q'),
+    cordova = require('../src/cordova/cordova'),
     cordova_util = require('../src/cordova/util'),
-    ConfigParser = require('../src/configparser/ConfigParser');
+    ConfigParser = require('../src/configparser/ConfigParser'),
+    project_dir = path.join(__dirname, 'fixtures', 'base');
 
 describe('save command', function(){
   var is_cordova, result, config_add_feature, cd_project;
@@ -47,14 +48,12 @@ describe('save command', function(){
   });
 
   it('should not try to add features to config.xml', function(){
-   cd_project_root = spyOn(cordova_util, 'cdProjectRoot').andReturn(project_dir);
-    var call_count =0;
-    ConfigParser.prototype.write = function(){
-      call_count++;
-    }
-    expect(call_count).toEqual(0);
+    cd_project_root = spyOn(cordova_util, 'cdProjectRoot').andReturn(project_dir);
+    var parserWriter = spyOn(ConfigParser.prototype, 'write');
+    expect(ConfigParser.prototype.write).not.toHaveBeenCalled();
     cordova.save('plugins');
-    expect(call_count).toEqual(0);
+    expect(ConfigParser.prototype.write).not.toHaveBeenCalled();
+    parserWriter.andCallThrough();
   });
 
 


Mime
View raw message