Updated Branches: refs/heads/master 1148e6f73 -> 1fe77b0be
Added a spec for [CB-4376]. Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/0fa097c6 Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/0fa097c6 Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/0fa097c6 Branch: refs/heads/master Commit: 0fa097c6675774c96bfb91011acfc43e296aaa32 Parents: 1a588d0 Author: Fil Maj <[email protected]> Authored: Wed Jul 24 20:38:52 2013 -0700 Committer: Fil Maj <[email protected]> Committed: Wed Jul 24 20:38:58 2013 -0700 ---------------------------------------------------------------------- spec/prepare.spec.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0fa097c6/spec/prepare.spec.js ---------------------------------------------------------------------- diff --git a/spec/prepare.spec.js b/spec/prepare.spec.js index fba7cb6..c9b184e 100644 --- a/spec/prepare.spec.js +++ b/spec/prepare.spec.js @@ -77,9 +77,23 @@ describe('prepare command', function() { cordova.prepare(); expect(is_cordova).toHaveBeenCalled(); }); - it('should parse user\'s config.xml by calling instantiating a config_parser', function() { - cordova.prepare(); - expect(config_parser).toHaveBeenCalledWith(path.join(project_dir, 'www', 'config.xml')); + it('should parse user\'s config.xml by instantiating a config_parser only _after_ before_prepare is called', function() { + var before_prep, after_prep, cont; + fire.andCallFake(function(e, opts, cb) { + if (e == 'before_prepare') { + before_prep = true; + } + cont = cb; + }); + runs(function() { + cordova.prepare(); + }); + waitsFor(function() { return before_prep; }); + runs(function() { + expect(config_parser).not.toHaveBeenCalled(); + cont(); + expect(config_parser).toHaveBeenCalledWith(path.join(project_dir, 'www', 'config.xml')); + }); }); it('should invoke each platform\'s parser\'s update_project method', function() { cordova.prepare();
