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)~~
* Writes to stderr must not break the build
* 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
* Build every commit, commit with tag, etc
* Safe id and build numbers generation

View File

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

View File

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

View File

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

View File

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