2009-05-29 03:02:15 +00:00
|
|
|
describe('jasmine.Reporter', function() {
|
|
|
|
var env;
|
|
|
|
|
2009-08-13 14:52:44 +00:00
|
|
|
|
2009-05-29 03:02:15 +00:00
|
|
|
beforeEach(function() {
|
|
|
|
env = new jasmine.Env();
|
2009-10-06 05:36:10 +00:00
|
|
|
env.updateInterval = 0;
|
2009-05-29 03:02:15 +00:00
|
|
|
});
|
|
|
|
|
2009-08-01 22:28:39 +00:00
|
|
|
it('should get called from the test runner', function() {
|
2009-05-29 03:02:15 +00:00
|
|
|
env.describe('Suite for JSON Reporter with Callbacks', function () {
|
|
|
|
env.it('should be a test', function() {
|
|
|
|
this.runs(function () {
|
|
|
|
this.expect(true).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
env.it('should be a failing test', function() {
|
|
|
|
this.runs(function () {
|
|
|
|
this.expect(false).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
env.describe('Suite for JSON Reporter with Callbacks 2', function () {
|
|
|
|
env.it('should be a test', function() {
|
|
|
|
this.runs(function () {
|
|
|
|
this.expect(true).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var foo = 0;
|
|
|
|
var bar = 0;
|
|
|
|
var baz = 0;
|
|
|
|
|
2010-06-23 00:35:41 +00:00
|
|
|
env.addReporter({
|
|
|
|
reportSpecResults: function() {
|
|
|
|
foo++;
|
|
|
|
},
|
|
|
|
reportSuiteResults: function() {
|
|
|
|
bar++;
|
|
|
|
},
|
|
|
|
reportRunnerResults: function() {
|
|
|
|
baz++;
|
|
|
|
}
|
2009-05-29 03:02:15 +00:00
|
|
|
});
|
|
|
|
|
2009-09-28 23:23:21 +00:00
|
|
|
var runner = env.currentRunner();
|
2009-05-29 03:02:15 +00:00
|
|
|
runner.execute();
|
|
|
|
|
|
|
|
expect(foo).toEqual(3); // 'foo was expected to be 3, was ' + foo);
|
|
|
|
expect(bar).toEqual(2); // 'bar was expected to be 2, was ' + bar);
|
|
|
|
expect(baz).toEqual(1); // 'baz was expected to be 1, was ' + baz);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|