#expect = require("chai").expect path = require("path") Robot = require("hubot/src/robot") TextMessage = require("hubot/src/message").TextMessage before = (done) -> robot = new Robot null, "mock-adapter", no, 'asjon' robot.adapter.on 'connected', -> # Initialize mocked environment user = robot.brain.userForId "1", { name: 'mocha', room: '#mocha' } adapter = robot.adapter send = (s) -> robot.adapter.receive new TextMessage user, s receive = (f) -> robot.adapter.on 'send', f after = -> robot.shutdown() clear = -> robot.adapter.removeAllListeners(); robot.httpListener = -> # Done done robot: robot, user: user, send: send, receive: receive TextMessage: TextMessage, Robot: Robot adapter: adapter, after: after, clear: clear robot.run() module.exports = before