Skip to content

Commit

Permalink
growlmock helper for testability, correct helper test
Browse files Browse the repository at this point in the history
  • Loading branch information
rburns committed Jul 15, 2012
1 parent 7cee76e commit f75d012
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion tasks/growl.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ module.exports = function(grunt) {
// HELPERS
// ==========================================================================

grunt.registerHelper('growl', growlMessage);
grunt.registerHelper('growl', function(config){
growlMessage(config);
});

grunt.registerHelper('growlmock', function(mock){
growlMessage = mock;
});

// ==========================================================================
// DEFAULT NOTIFICATIONS
Expand Down
14 changes: 7 additions & 7 deletions test/growl_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ var grunt = require('grunt');
*/

exports['growl'] = {
setUp: function(done) {
// setup here
done();
},
'helper': function(test) {
test.expect(1);
// tests here
test.equal(grunt.helper('growl'), 'growl!!!', 'should return the correct value.');
test.done();

grunt.helper('growlmock', function(config) {
test.equal(config.message, 'test message', 'should use message property.');
test.done();
});

grunt.helper('growl', {message:'test message'});
}
};

0 comments on commit f75d012

Please sign in to comment.