Remove version/versionString and currentRunner

- Instead of version/versionString, jasmine.version should be sufficient
- currentRunner was exposing Jasmine's internal top level suite
This commit is contained in:
Sheel Choksi
2013-10-24 15:42:46 -07:00
parent f1613ce77c
commit d9ece1f14f
2 changed files with 13 additions and 32 deletions

View File

@@ -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();
});
});
});

View File

@@ -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 + "()");