Merge pull request #106 from jaredevantabor/scan-job-templates

Scan job templates
This commit is contained in:
jaredevantabor
2015-03-27 15:57:18 -04:00
16 changed files with 1520 additions and 1089 deletions

View File

@@ -0,0 +1,24 @@
import jobTemplates from 'tower/job-templates/main';
import {describeModule} from '../describe-module';
describeModule(jobTemplates.name)
.testService('deleteJobTemplate', function(test, restStub) {
var service;
test.withService(function(_service) {
service = _service;
});
it('deletes the job template', function() {
var result = {};
var actual = service();
restStub.succeedOn('destroy', result);
restStub.flush();
expect(actual).to.eventually.equal(result);
});
});

View File

@@ -35,10 +35,19 @@ RestStub.prototype =
return this.deferred.promise;
},
destroy: function() {
this.deferred = this.deferred || {};
this.deferred.destroy = this[this.currentUrl];
return this.deferred.destroy.promise;
},
succeedAt: function(url, value) {
assertUrlDeferred(url, this);
this[url].resolve(value);
},
succeedOn: function(method, value) {
this.deferred[method] = value;
},
succeed: function(value) {
this.deferred.resolve(value);
},