diff --git a/test/unit/tasks/deploy/fetch.js b/test/unit/tasks/deploy/fetch.js index d220854..3dc9cbe 100644 --- a/test/unit/tasks/deploy/fetch.js +++ b/test/unit/tasks/deploy/fetch.js @@ -19,6 +19,7 @@ describe('deploy:fetch task', function () { fetchFactory(shipit); fetchFactory.__set__('mkdirp', mkdirpMock); + fetchFactory.__set__('rimraf', rimrafMock); // Shipit config shipit.initConfig({ @@ -35,6 +36,7 @@ describe('deploy:fetch task', function () { afterEach(function () { mkdirpMock.reset(); + rimrafMock.reset(); shipit.local.restore(); }); @@ -74,6 +76,16 @@ describe('deploy:fetch task', function () { done(); }); }); + + it('should do nothing when reposity url is empty', function (done) { + delete shipit.config.repositoryUrl; + + shipit.start('deploy:fetch', function (err) { + if (err) return done(err); + expect(mkdirpMock).callCount(0); + done(); + }); + }); it('should create workspace, create repo, checkout and call sync, update submodules', function (done) { shipit.config.updateSubmodules = true; diff --git a/test/unit/tasks/deploy/update.js b/test/unit/tasks/deploy/update.js index 0cdea4c..6d4a7a1 100644 --- a/test/unit/tasks/deploy/update.js +++ b/test/unit/tasks/deploy/update.js @@ -20,6 +20,7 @@ var createShipitInstance = function (conf) { shipit.initConfig({ test: _.merge({ workspace: '/tmp/workspace', + repositoryUrl: 'git://website.com/user/repo', deployTo: '/remote/deploy' }, conf) }); @@ -253,6 +254,16 @@ describe('deploy:update task', function () { }); }); }); + + it('should not set revision if no repository url is present', function (done) { + delete shipit.config.repositoryUrl; + + shipit.start('deploy:update', function (err) { + if (err) return done(err); + expect(shipit.currentRevision).to.equal(undefined); + done(); + }); + }); it('should copy contents of previous release into new folder', function (done) { shipit.start('deploy:update', function (err) {