Minor code refactoring
Add specs for tasks.js.coffee