From d9ece1f14f41c8366fb88484cc0ca5c0b8a80372 Mon Sep 17 00:00:00 2001 From: Sheel Choksi Date: Thu, 24 Oct 2013 15:42:46 -0700 Subject: [PATCH] Remove version/versionString and currentRunner - Instead of version/versionString, jasmine.version should be sufficient - currentRunner was exposing Jasmine's internal top level suite --- spec/core/ExceptionsSpec.js | 31 +++++++++++++------------------ src/core/Env.js | 14 -------------- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/spec/core/ExceptionsSpec.js b/spec/core/ExceptionsSpec.js index b5f4302e..fad90230 100644 --- a/spec/core/ExceptionsSpec.js +++ b/spec/core/ExceptionsSpec.js @@ -8,16 +8,15 @@ describe('Exceptions:', function() { describe('with break on exception', function() { it('should not catch the exception', function() { env.catchExceptions(false); - var suite = env.describe('suite for break on exceptions', function() { + env.describe('suite for break on exceptions', function() { env.it('should break when an exception is thrown', function() { throw new Error('I should hit a breakpoint!'); }); }); - var runner = env.currentRunner(); var dont_change = 'I will never change!'; try { - suite.execute(); + env.execute(); dont_change = 'oops I changed'; } catch (e) {} @@ -28,36 +27,32 @@ describe('Exceptions:', function() { describe("with catch on exception", function() { it('should handle exceptions thrown, but continue', function() { - var ranSecondTest = false, - suite = env.describe('Suite for handles exceptions', function () { + var secondTest = jasmine.createSpy('second test'); + env.describe('Suite for handles exceptions', function () { env.it('should be a test that fails because it throws an exception', function() { throw new Error(); }); - env.it('should be a passing test that runs after exceptions are thrown from a async test', function() { - ranSecondTest = true; - }); + env.it('should be a passing test that runs after exceptions are thrown from a async test', secondTest); }); - suite.execute(); - expect(ranSecondTest).toBe(true); + env.execute(); + expect(secondTest).toHaveBeenCalled(); }); it("should handle exceptions thrown directly in top-level describe blocks and continue", function () { - var ranSecondDescribe = false, suite, suite2, runner = env.currentRunner(); - suite = env.describe("a suite that throws an exception", function () { + var secondDescribe = jasmine.createSpy("second describe"); + env.describe("a suite that throws an exception", function () { env.it("is a test that should pass", function () { this.expect(true).toEqual(true); }); throw new Error("top level error"); }); - suite2 = env.describe("a suite that doesn't throw an exception", function () { - ranSecondDescribe = true; - }); + env.describe("a suite that doesn't throw an exception", secondDescribe); - runner.execute(); - expect(ranSecondDescribe).toBe(true); + env.execute(); + expect(secondDescribe).toHaveBeenCalled(); }); }); - }); + diff --git a/src/core/Env.js b/src/core/Env.js index af163ac5..62ce9e03 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -175,20 +175,6 @@ getJasmineRequireObj().Env = function(j$) { j$.Expectation.addMatchers(matchersToAdd); }; - this.version = function() { - return j$.version; - }; - - this.versionString = function() { - console.log("DEPRECATED == use j$.version"); - return j$.version; - }; - - // TODO: Still needed? - this.currentRunner = function() { - return topSuite; - }; - this.spyOn = function(obj, methodName) { if (j$.util.isUndefined(obj)) { throw new Error("spyOn could not find an object to spy upon for " + methodName + "()");