before(function(done) {
    robot = new Robot(null, "mock-adapter", true, "Hubot");

    // Hack. Need a better solution than stubbing out methods.
    if (disableLogger) {
      robot.logger.error = controlledLogger;
      robot.logger.warning = controlledLogger;
      robot.logger.info = controlledLogger;
      robot.logger.debug = controlledLogger;
    }

    disableAuth();


    robot.adapter.on("connected", function() {

      // Load script under test
      st2bot = require("../scripts/stackstorm");

      st2bot(robot).then(function(result) {
        stop = result;
        // Load help module
        robot.loadFile(path.resolve('node_modules', 'hubot-help', 'src'), 'help.coffee');

        user = robot.brain.userForId("1", {
          name: "mocha",
          room: "#mocha"
        });

        adapter = robot.adapter;
        done();
      }).catch(function(err) {
        console.log(err);
        done(err);
      });
    });

    robot.run();
  });
  beforeEach(function(done) {
      // create new robot, without http, using the mock adapter
      robot = new Robot(null, "mock-adapter", false, "TestBot");

      robot.adapter.on("connected", function() { 
          // only load scripts we absolutely need, like auth.coffee
          process.env.HUBOT_AUTH_ADMIN = "1";
          robot.loadFile(
              path.resolve(
                  path.join("node_modules/hubot/src/scripts")
              ),
              "auth.coffee"
          );

          // load the module under test and configure it for the
          // robot.  This is in place of external-scripts
          require("../index")(robot);

          // create a user
          user = robot.brain.userForId("1", {
              name: "mocha",
              room: "#mocha"
          });

          // create a second user if we want to observer user to
          // user interaction
          user2 = robot.brain.userForId("2", {
              name: "chai",
              room: "#mocha"
          });

          adapter = robot.adapter;

          setTimeout(done, 250);
      });
      robot.run();
  });