rename notification strategies according to statuses

This commit is contained in:
oleg 2015-06-21 23:53:03 +03:00
parent d24b5b984b
commit 96a7509280
5 changed files with 12 additions and 12 deletions

View File

@ -15,7 +15,7 @@ work in progress...
* ~~Project relations (blocks, triggers, etc)~~ * ~~Project relations (blocks, triggers, etc)~~
* Writes to stderr must not break the build * Writes to stderr must not break the build
* Mail and jabber notifications (with commits, current step and error) * Mail and jabber notifications (with commits, current step and error)
* Rename notification strategies according to statuses * ~~Rename notification strategies according to statuses~~
* Work with git * Work with git
* Build every commit, commit with tag, etc * Build every commit, commit with tag, etc
* Safe id and build numbers generation * Safe id and build numbers generation

View File

@ -7,7 +7,7 @@ scm:
notify: notify:
on: on:
- fail - error
to: to:
console: console:

View File

@ -6,8 +6,8 @@ scm:
notify: notify:
on: on:
# - success # - done
# - fail # - error
- change - change
to: to:
console: console:

View File

@ -74,9 +74,9 @@ exports.send = function(build, callback) {
}, },
function(err, notify, prevBuild) { function(err, notify, prevBuild) {
var strategy = _(notify.on).find(function(strategy) { var strategy = _(notify.on).find(function(strategy) {
if (strategy === 'success') { if (strategy === 'done') {
return build.status === 'done'; return build.status === 'done';
} else if (strategy === 'fail') { } else if (strategy === 'error') {
return build.status === 'error'; return build.status === 'error';
} else if (strategy === 'change') { } else if (strategy === 'change') {
// notify on status change or about first build // notify on status change or about first build

View File

@ -77,11 +77,11 @@ describe('notifier module', function() {
}).extend(build); }).extend(build);
}; };
describe('notify on success', function() { describe('notify on done', function() {
it('set build info', function() { it('set build info', function() {
build = makeBuild({ build = makeBuild({
status: 'done', status: 'done',
project: {notify: {on: ['success']}} project: {notify: {on: ['done']}}
}); });
sendSpy.reset(); sendSpy.reset();
}); });
@ -96,7 +96,7 @@ describe('notifier module', function() {
it('should be notified with right params', function() { it('should be notified with right params', function() {
expect(sendSpy.calledWith({ expect(sendSpy.calledWith({
notifyReason: {strategy: 'success'}, notifyReason: {strategy: 'done'},
build: build build: build
})).equal(true); })).equal(true);
}); });
@ -115,11 +115,11 @@ describe('notifier module', function() {
}); });
}); });
describe('notify on fail', function() { describe('notify on error', function() {
it('set build info', function() { it('set build info', function() {
build = makeBuild({ build = makeBuild({
status: 'error', status: 'error',
project: {notify: {on: ['fail']}} project: {notify: {on: ['error']}}
}); });
sendSpy.reset(); sendSpy.reset();
}); });
@ -134,7 +134,7 @@ describe('notifier module', function() {
it('should be notified with right params', function() { it('should be notified with right params', function() {
expect(sendSpy.calledWith({ expect(sendSpy.calledWith({
notifyReason: {strategy: 'fail'}, notifyReason: {strategy: 'error'},
build: build build: build
})).equal(true); })).equal(true);
}); });