From f9d61108ee0fce25e655f2a2c9f4ade0cd806c39 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Fri, 21 Aug 2009 07:00:54 -0700 Subject: [PATCH] Minor version changes --- lib/jasmine-0.9.0.js | 9 +++----- spec/suites/BaseTest.js | 6 ----- spec/suites/EnvTest.js | 49 ++++++++++++++++++++++++++++++++--------- src/Env.js | 7 ++---- src/version.json | 2 +- 5 files changed, 45 insertions(+), 28 deletions(-) delete mode 100644 spec/suites/BaseTest.js diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index 3de1afdc..dbfac26e 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -517,7 +517,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 0 + "revision": 1 }; /** * @namespace @@ -610,12 +610,9 @@ jasmine.Env.prototype.clearInterval = jasmine.clearInterval; jasmine.Env.prototype.version = function () { if (jasmine.version_) { - return parseInt(jasmine.version_.major + "" + - jasmine.version_.minor + "" + - jasmine.version_.build + "" + - jasmine.version_.revision + ""); + return jasmine.version_; } else { - return 0; + throw new Error('Version not set'); } }; diff --git a/spec/suites/BaseTest.js b/spec/suites/BaseTest.js deleted file mode 100644 index 6fb8216f..00000000 --- a/spec/suites/BaseTest.js +++ /dev/null @@ -1,6 +0,0 @@ -describe("base", function() { - describe("version", function() { - - - }); -}); \ No newline at end of file diff --git a/spec/suites/EnvTest.js b/spec/suites/EnvTest.js index e7e11ce9..3a05d3c5 100644 --- a/spec/suites/EnvTest.js +++ b/spec/suites/EnvTest.js @@ -8,16 +8,45 @@ describe("jasmine.Env", function() { fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]); }); - it("version should return the current version as an int", function() { - var oldVersion = jasmine.version_; - jasmine.version_ = { - "major": 1, - "minor": 9, - "build": 7, - "revision": 8 - }; - expect(env.version()).toEqual(1978); - jasmine.version_ = oldVersion; + 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 + }); + + }); }); it("should allow reporters to be registered", function() { diff --git a/src/Env.js b/src/Env.js index 2938e9bb..37626ecc 100644 --- a/src/Env.js +++ b/src/Env.js @@ -30,12 +30,9 @@ jasmine.Env.prototype.clearInterval = jasmine.clearInterval; jasmine.Env.prototype.version = function () { if (jasmine.version_) { - return parseInt(jasmine.version_.major + "" + - jasmine.version_.minor + "" + - jasmine.version_.build + "" + - jasmine.version_.revision + ""); + return jasmine.version_; } else { - return 0; + throw new Error('Version not set'); } }; diff --git a/src/version.json b/src/version.json index f5ac4347..5d4cfc68 100644 --- a/src/version.json +++ b/src/version.json @@ -2,5 +2,5 @@ "major": 0, "minor": 9, "build": 0, - "revision": 0 + "revision": 1 } \ No newline at end of file