2009-07-09 01:18:17 +00:00
|
|
|
describe("jasmine.Env", function() {
|
2009-09-28 18:13:44 +00:00
|
|
|
|
|
|
|
describe('ids', function () {
|
|
|
|
var env;
|
|
|
|
beforeEach(function() {
|
|
|
|
env = new jasmine.Env();
|
|
|
|
});
|
|
|
|
it('nextSpecId should return consecutive integers, starting at 0', function () {
|
|
|
|
expect(env.nextSpecId()).toEqual(0);
|
|
|
|
expect(env.nextSpecId()).toEqual(1);
|
|
|
|
expect(env.nextSpecId()).toEqual(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('nextSuiteId should return consecutive integers, starting at 0', function () {
|
|
|
|
expect(env.nextSuiteId()).toEqual(0);
|
|
|
|
expect(env.nextSuiteId()).toEqual(1);
|
|
|
|
expect(env.nextSuiteId()).toEqual(2);
|
|
|
|
});
|
|
|
|
});
|
2009-07-09 01:18:17 +00:00
|
|
|
describe("reporting", function() {
|
|
|
|
var env;
|
|
|
|
var fakeReporter;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
env = new jasmine.Env();
|
|
|
|
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]);
|
|
|
|
});
|
|
|
|
|
2009-08-21 14:00:54 +00:00
|
|
|
describe('version', function () {
|
|
|
|
var oldVersion;
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
oldVersion = jasmine.version_;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
jasmine.version_ = oldVersion;
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should raise an error if version is not set', function () {
|
|
|
|
jasmine.version_ = null;
|
|
|
|
var exception;
|
|
|
|
try {
|
|
|
|
env.version();
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
exception = e;
|
|
|
|
}
|
|
|
|
expect(exception.message).toEqual('Version not set');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
it("version should return the current version as an int", function() {
|
|
|
|
jasmine.version_ = {
|
|
|
|
"major": 1,
|
|
|
|
"minor": 9,
|
|
|
|
"build": 7,
|
|
|
|
"revision": 8
|
|
|
|
};
|
|
|
|
expect(env.version()).toEqual({
|
|
|
|
"major": 1,
|
|
|
|
"minor": 9,
|
|
|
|
"build": 7,
|
|
|
|
"revision": 8
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2009-08-21 05:16:14 +00:00
|
|
|
});
|
|
|
|
|
2009-07-09 01:18:17 +00:00
|
|
|
it("should allow reporters to be registered", function() {
|
|
|
|
env.addReporter(fakeReporter);
|
|
|
|
env.reporter.log("message");
|
|
|
|
expect(fakeReporter.log).wasCalledWith("message");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|