Add test for Robot#log
This commit is contained in:
parent
8272efe060
commit
754af3b4db
|
@ -3,7 +3,8 @@
|
|||
|
||||
var Driver = source("driver"),
|
||||
Adaptor = source("adaptor"),
|
||||
Robot = source("robot");
|
||||
Robot = source("robot"),
|
||||
Logger = source("logger");
|
||||
|
||||
describe("Robot", function() {
|
||||
var work, extraFunction, robot;
|
||||
|
@ -574,4 +575,25 @@ describe("Robot", function() {
|
|||
expect(robot.toString()).to.be.eql("[Robot name='Robby']");
|
||||
});
|
||||
});
|
||||
|
||||
describe("#log", function() {
|
||||
beforeEach(function() {
|
||||
stub(Logger, "info");
|
||||
stub(Logger, "fatal");
|
||||
|
||||
robot.log("info", "an informative message");
|
||||
robot.log("fatal", "a fatal error");
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
Logger.info.restore();
|
||||
Logger.fatal.restore();
|
||||
});
|
||||
|
||||
it("it passes messages onto Logger, with the Robot's name", function() {
|
||||
var nameStr = "[" + robot.name + "] -";
|
||||
expect(Logger.info).to.be.calledWith(nameStr, "an informative message");
|
||||
expect(Logger.fatal).to.be.calledWith(nameStr, "a fatal error");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue