Rename j$ to jasmineUnderTest for specs

- Clarifies what it is for when writing tests
- No longer named the same as the `jasmine` that is injected into live
  code
This commit is contained in:
Gregg Van Hove
2015-12-03 17:23:32 -08:00
parent a95c2cfe3f
commit 79206ccff5
60 changed files with 702 additions and 896 deletions

View File

@@ -1,8 +1,8 @@
describe("Suite", function() {
it("keeps its id", function() {
var env = new j$.Env(),
suite = new j$.Suite({
var env = new jasmineUnderTest.Env(),
suite = new jasmineUnderTest.Suite({
env: env,
id: 456,
description: "I am a suite"
@@ -12,8 +12,8 @@ describe("Suite", function() {
});
it("returns its full name", function() {
var env = new j$.Env(),
suite = new j$.Suite({
var env = new jasmineUnderTest.Env(),
suite = new jasmineUnderTest.Suite({
env: env,
description: "I am a suite"
});
@@ -22,13 +22,13 @@ describe("Suite", function() {
});
it("returns its full name when it has parent suites", function() {
var env = new j$.Env(),
parentSuite = new j$.Suite({
var env = new jasmineUnderTest.Env(),
parentSuite = new jasmineUnderTest.Suite({
env: env,
description: "I am a parent suite",
parentSuite: jasmine.createSpy('pretend top level suite')
}),
suite = new j$.Suite({
suite = new jasmineUnderTest.Suite({
env: env,
description: "I am a suite",
parentSuite: parentSuite
@@ -38,8 +38,8 @@ describe("Suite", function() {
});
it("adds before functions in order of needed execution", function() {
var env = new j$.Env(),
suite = new j$.Suite({
var env = new jasmineUnderTest.Env(),
suite = new jasmineUnderTest.Suite({
env: env,
description: "I am a suite"
}),
@@ -53,8 +53,8 @@ describe("Suite", function() {
});
it("adds after functions in order of needed execution", function() {
var env = new j$.Env(),
suite = new j$.Suite({
var env = new jasmineUnderTest.Env(),
suite = new jasmineUnderTest.Suite({
env: env,
description: "I am a suite"
}),
@@ -68,7 +68,7 @@ describe("Suite", function() {
});
it('has a status of failed if any afterAll expectations have failed', function() {
var suite = new j$.Suite({
var suite = new jasmineUnderTest.Suite({
expectationResultFactory: function() { return 'hi'; }
});
suite.addChild({ result: { status: 'done' } });
@@ -78,27 +78,27 @@ describe("Suite", function() {
});
it("retrieves a result with updated status", function() {
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
expect(suite.getResult().status).toBe('finished');
});
it("retrieves a result with disabled status", function() {
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
suite.disable();
expect(suite.getResult().status).toBe('disabled');
});
it("retrieves a result with pending status", function() {
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
suite.pend();
expect(suite.getResult().status).toBe('pending');
});
it("priviledges a disabled status over pending status", function() {
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
suite.disable();
suite.pend();
@@ -106,20 +106,20 @@ describe("Suite", function() {
});
it("is executable if not disabled", function() {
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
expect(suite.isExecutable()).toBe(true);
});
it("is not executable if disabled", function() {
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
suite.disable();
expect(suite.isExecutable()).toBe(false);
});
it("tells all children about expectation failures, even if one throws", function() {
var suite = new j$.Suite({}),
var suite = new jasmineUnderTest.Suite({}),
child1 = { addExpectationResult: jasmine.createSpy('child1#expectationResult'), result: {} },
child2 = { addExpectationResult: jasmine.createSpy('child2#expectationResult'), result: {} };
@@ -135,7 +135,7 @@ describe("Suite", function() {
});
it("throws an ExpectationFailed when receiving a failed expectation in an afterAll when throwOnExpectationFailure is set", function() {
var suite = new j$.Suite({
var suite = new jasmineUnderTest.Suite({
expectationResultFactory: function(data) { return data; },
throwOnExpectationFailure: true
});
@@ -143,17 +143,17 @@ describe("Suite", function() {
expect(function() {
suite.addExpectationResult(false, 'failed');
}).toThrowError(j$.errors.ExpectationFailed);
}).toThrowError(jasmineUnderTest.errors.ExpectationFailed);
expect(suite.status()).toBe('failed');
expect(suite.result.failedExpectations).toEqual(['failed']);
});
it("does not add an additional failure when an expectation fails in an afterAll", function(){
var suite = new j$.Suite({});
var suite = new jasmineUnderTest.Suite({});
suite.addChild({ result: { status: 'done' } });
suite.onException(new j$.errors.ExpectationFailed());
suite.onException(new jasmineUnderTest.errors.ExpectationFailed());
expect(suite.getResult().failedExpectations).toEqual([]);
})