2009-07-09 01:18:17 +00:00
|
|
|
describe("jasmine.MultiReporter", function() {
|
2009-07-09 01:33:15 +00:00
|
|
|
var multiReporter, fakeReporter1, fakeReporter2;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
multiReporter = new jasmine.MultiReporter();
|
|
|
|
fakeReporter1 = jasmine.createSpyObj("fakeReporter1", ["reportSpecResults"]);
|
|
|
|
fakeReporter2 = jasmine.createSpyObj("fakeReporter2", ["reportSpecResults", "reportRunnerStarting"]);
|
2009-07-09 00:55:25 +00:00
|
|
|
multiReporter.addReporter(fakeReporter1);
|
|
|
|
multiReporter.addReporter(fakeReporter2);
|
2009-07-09 01:33:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should support all the method calls that jasmine.Reporter supports", function() {
|
|
|
|
multiReporter.reportRunnerStarting();
|
|
|
|
multiReporter.reportRunnerResults();
|
|
|
|
multiReporter.reportSuiteResults();
|
|
|
|
multiReporter.reportSpecResults();
|
|
|
|
multiReporter.log();
|
|
|
|
});
|
2009-07-09 00:55:25 +00:00
|
|
|
|
2009-07-09 01:33:15 +00:00
|
|
|
it("should delegate to any and all subreporters", function() {
|
2009-07-09 00:55:25 +00:00
|
|
|
multiReporter.reportSpecResults('blah', 'foo');
|
2010-06-24 17:34:03 +00:00
|
|
|
expect(fakeReporter1.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
|
|
|
|
expect(fakeReporter2.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
|
2009-07-09 00:55:25 +00:00
|
|
|
});
|
2009-07-09 01:33:15 +00:00
|
|
|
|
|
|
|
it("should quietly skip delegating to any subreporters which lack the given method", function() {
|
|
|
|
multiReporter.reportRunnerStarting('blah', 'foo');
|
2010-06-24 17:34:03 +00:00
|
|
|
expect(fakeReporter2.reportRunnerStarting).toHaveBeenCalledWith('blah', 'foo');
|
2009-07-09 01:33:15 +00:00
|
|
|
});
|
2009-07-09 00:55:25 +00:00
|
|
|
});
|