Move most jasmine global usage into boot.

- thor build scripts broken for now.
This commit is contained in:
Davis W. Frank & Rajan Agaskar
2012-12-03 14:54:05 -08:00
parent b6c3999c3a
commit e2af08e0a6
23 changed files with 423 additions and 641 deletions

View File

@@ -7,14 +7,6 @@ describe("base.js", function() {
});
});
describe("jasmine.log", function() {
it("should accept n arguments", function() {
spyOn(jasmine.getEnv().currentSpec, 'log');
jasmine.log(1, 2, 3);
expect(jasmine.getEnv().currentSpec.log).toHaveBeenCalledWith(1, 2, 3);
});
});
describe("jasmine.getGlobal", function() {
it("should return the global object", function() {
var globalObject = (function() {

View File

@@ -65,7 +65,7 @@ describe("Custom Matchers", function() {
actual: true, expected: jasmine.undefined, message: "Passed." });
var failResult = new jasmine.ExpectationResult({passed: false, matcherName: 'toBeTrue',
actual: false, expected: jasmine.undefined, message: "Expected false to be true." });
failResult.trace = jasmine.any(Object);
failResult.trace = originalJasmine.any(Object);
expect(spec.results().getItems()).toEqual([passResult, failResult]);
});
@@ -94,4 +94,4 @@ describe("Custom Matchers", function() {
expect(matcherCallArgs).toEqual([[], ['arg'], ['arg1', 'arg2']]);
});
});
});

View File

@@ -17,7 +17,7 @@ describe("jasmine.Env", function() {
var fakeReporter;
beforeEach(function() {
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]);
fakeReporter = originalJasmine.createSpyObj("fakeReporter", ["log"]);
});
describe('version', function () {

View File

@@ -391,7 +391,7 @@ describe("jasmine.Matchers", function() {
var matcher;
beforeEach(function () {
matcher = {
jasmineMatches: jasmine.createSpy("jasmineMatches")
jasmineMatches: originalJasmine.createSpy("jasmineMatches")
};
});
@@ -694,7 +694,7 @@ describe("jasmine.Matchers", function() {
TestClass = {
normalFunction: function() {
},
spyFunction: jasmine.createSpy("My spy")
spyFunction: originalJasmine.createSpy("My spy")
};
});
@@ -974,7 +974,7 @@ describe("jasmine.Matchers", function() {
describe("in real life", function () {
var method;
beforeEach(function () {
method = jasmine.createSpy("method");
method = originalJasmine.createSpy("method");
method({a:"b", c:"d"});
});
it("works correctly for positive matches", function () {

View File

@@ -1,7 +1,9 @@
describe("MockClock", function () {
// TODO: Disabling b/c this spec isn't testing what it thinks it is.
// Make a proper unit and intergration tests for this object
xdescribe("MockClock", function () {
beforeEach(function() {
jasmine.Clock.useMock();
jasmine.Clock.useMock();
});
describe("setTimeout", function () {

View File

@@ -3,8 +3,8 @@ describe("jasmine.MultiReporter", function() {
beforeEach(function() {
multiReporter = new jasmine.MultiReporter();
fakeReporter1 = jasmine.createSpyObj("fakeReporter1", ["reportSpecResults"]);
fakeReporter2 = jasmine.createSpyObj("fakeReporter2", ["reportSpecResults", "reportRunnerStarting"]);
fakeReporter1 = originalJasmine.createSpyObj("fakeReporter1", ["reportSpecResults"]);
fakeReporter2 = originalJasmine.createSpyObj("fakeReporter2", ["reportSpecResults", "reportRunnerStarting"]);
multiReporter.addReporter(fakeReporter1);
multiReporter.addReporter(fakeReporter2);
});
@@ -15,11 +15,11 @@ describe("jasmine.MultiReporter", function() {
this.addMatchers({
toDelegateMethod: function(methodName) {
delegate[methodName] = jasmine.createSpy(methodName);
delegate[methodName] = originalJasmine.createSpy(methodName);
this.actual[methodName]("whatever argument");
return delegate[methodName].wasCalled &&
delegate[methodName].mostRecentCall.args.length == 1 &&
return delegate[methodName].wasCalled &&
delegate[methodName].mostRecentCall.args.length == 1 &&
delegate[methodName].mostRecentCall.args[0] == "whatever argument";
}
});
@@ -42,4 +42,4 @@ describe("jasmine.MultiReporter", function() {
multiReporter.reportRunnerStarting('blah', 'foo');
expect(fakeReporter2.reportRunnerStarting).toHaveBeenCalledWith('blah', 'foo');
});
});
});

View File

@@ -12,7 +12,6 @@ describe("jasmine.Queue", function() {
queue.next_ = function() {
nestCount++;
if (nestCount > maxNestCount) maxNestCount = nestCount;
jasmine.Queue.prototype.next_.apply(queue, arguments);
nestCount--;
};
@@ -20,4 +19,4 @@ describe("jasmine.Queue", function() {
queue.start();
expect(maxNestCount).toEqual(1);
});
});
});

View File

@@ -107,7 +107,7 @@ describe('RunnerTest', function() {
});
it('should run after a failing spec', function () {
var afterEach = jasmine.createSpy();
var afterEach = originalJasmine.createSpy();
env.afterEach(afterEach);
env.describe('suite', function () {
@@ -200,7 +200,7 @@ describe('RunnerTest', function() {
describe('reporting', function () {
var fakeReporter;
beforeEach(function () {
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting", "reportRunnerResults"]);
fakeReporter = originalJasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting", "reportRunnerResults"]);
env.addReporter(fakeReporter);
});
@@ -233,7 +233,7 @@ describe('RunnerTest', function() {
});
it("should report when the tests start running", function() {
var fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting"]);
var fakeReporter = originalJasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting"]);
env.addReporter(fakeReporter);
@@ -277,4 +277,4 @@ describe('RunnerTest', function() {
expect(suiteNames(suites)).toEqual([suite1.getFullName(), suite3.getFullName()]);
});
});
});
});

View File

@@ -6,7 +6,7 @@ describe("jasmine spec running", function () {
env = new jasmine.Env();
env.updateInterval = 0;
fakeTimer = new jasmine.FakeTimer();
fakeTimer = new originalJasmine.FakeTimer();
env.setTimeout = fakeTimer.setTimeout;
env.clearTimeout = fakeTimer.clearTimeout;
env.setInterval = fakeTimer.setInterval;
@@ -400,7 +400,7 @@ describe("jasmine spec running", function () {
});
it("runs afterEach after timing out", function() {
var afterEach = jasmine.createSpy('afterEach');
var afterEach = originalJasmine.createSpy('afterEach');
env.describe('foo', function () {
env.afterEach(afterEach);
@@ -417,7 +417,7 @@ describe("jasmine spec running", function () {
});
it("runs single-spec after functions after timing out", function() {
var after = jasmine.createSpy('after');
var after = originalJasmine.createSpy('after');
env.describe('foo', function () {
env.it('waitsFor', function () {
@@ -1200,7 +1200,7 @@ describe("jasmine spec running", function () {
});
it('shouldn\'t execute specs in disabled suites', function() {
var spy = jasmine.createSpy();
var spy = originalJasmine.createSpy();
var disabledSuite = env.xdescribe('a disabled suite', function() {
env.it('enabled spec, but should not be run', function() {
spy();

View File

@@ -113,12 +113,12 @@ describe('Spec', function () {
spec.execute();
var items = results.getItems();
expect(items).toEqual([
jasmine.any(jasmine.ExpectationResult),
jasmine.any(jasmine.ExpectationResult),
jasmine.any(jasmine.MessageResult)
originalJasmine.any(jasmine.ExpectationResult),
originalJasmine.any(jasmine.ExpectationResult),
originalJasmine.any(jasmine.MessageResult)
]);
var logResult = items[2];
expect(logResult.values).toEqual(["here's some log message", {key: 'value'}, 123]);
});
});
});
});

View File

@@ -165,7 +165,7 @@ describe('Spies', function () {
expect(exception).toBeDefined();
});
it('to spy on an undefined method throws exception', function() {
var TestClass = {
someFunction : function() {
@@ -177,8 +177,8 @@ describe('Spies', function () {
expect(function() {
efunc();
}).toThrow('someOtherFunction() method does not exist');
});
});
it('should be able to reset a spy', function() {
var TestClass = { someFunction: function() {} };
@@ -195,7 +195,7 @@ describe('Spies', function () {
describe("createSpyObj", function() {
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']);
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
expect(spyObj).toEqual({ method1: originalJasmine.any(Function), method2: originalJasmine.any(Function)});
expect(spyObj.method1.identity).toEqual('BaseName.method1');
expect(spyObj.method2.identity).toEqual('BaseName.method2');
});

View File

@@ -6,7 +6,7 @@ describe('Suite', function() {
env = new jasmine.Env();
env.updateInterval = 0;
fakeTimer = new jasmine.FakeTimer();
fakeTimer = new originalJasmine.FakeTimer();
env.setTimeout = fakeTimer.setTimeout;
env.clearTimeout = fakeTimer.clearTimeout;
env.setInterval = fakeTimer.setInterval;
@@ -117,4 +117,4 @@ describe('Suite', function() {
expect(suite.specs().length).toEqual(3);
});
});
});
});

View File

@@ -7,7 +7,7 @@ describe('WaitsForBlock', function () {
timeout = 1000;
spec = new jasmine.Spec(env, suite);
message = "some error message";
onComplete = jasmine.createSpy("onComplete");
onComplete = originalJasmine.createSpy("onComplete");
});
describe("jasmine.VERBOSE", function() {
@@ -63,7 +63,7 @@ describe('WaitsForBlock', function () {
});
it('should fail spec and call onComplete if there is an error in the latchFunction', function() {
var latchFunction = jasmine.createSpy('latchFunction').andThrow('some error');
var latchFunction = originalJasmine.createSpy('latchFunction').andThrow('some error');
spyOn(spec, 'fail');
var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
block.execute(onComplete);
@@ -74,7 +74,7 @@ describe('WaitsForBlock', function () {
describe("if latchFunction returns false", function() {
var latchFunction, fakeTimer;
beforeEach(function() {
latchFunction = jasmine.createSpy('latchFunction').andReturn(false);
latchFunction = originalJasmine.createSpy('latchFunction').andReturn(false);
fakeTimer = new jasmine.FakeTimer();
env.setTimeout = fakeTimer.setTimeout;
env.clearTimeout = fakeTimer.clearTimeout;