Fixed some specs that were not referring to the correct instance of Jasmine
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
describe("toContain", function() {
|
describe("toContain", function() {
|
||||||
it("delegates to j$.matchersUtil.contains", function() {
|
it("delegates to j$.matchersUtil.contains", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: j$.createSpy('delegated-contains').andReturn(true)
|
contains: jasmine.createSpy('delegated-contains').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toContain(util);
|
matcher = j$.matchers.toContain(util);
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ describe("toContain", function() {
|
|||||||
|
|
||||||
it("delegates to j$.matchersUtil.contains, passing in equality testers if present", function() {
|
it("delegates to j$.matchersUtil.contains, passing in equality testers if present", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: j$.createSpy('delegated-contains').andReturn(true)
|
contains: jasmine.createSpy('delegated-contains').andReturn(true)
|
||||||
},
|
},
|
||||||
customEqualityTesters = ['a', 'b'],
|
customEqualityTesters = ['a', 'b'],
|
||||||
matcher = j$.matchers.toContain(util, customEqualityTesters);
|
matcher = j$.matchers.toContain(util, customEqualityTesters);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
describe("toEqual", function() {
|
describe("toEqual", function() {
|
||||||
it("delegates to equals function", function() {
|
it("delegates to equals function", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equals').andReturn(true)
|
equals: jasmine.createSpy('delegated-equals').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toEqual(util),
|
matcher = j$.matchers.toEqual(util),
|
||||||
result;
|
result;
|
||||||
@@ -14,7 +14,7 @@ describe("toEqual", function() {
|
|||||||
|
|
||||||
it("delegates custom equality testers, if present", function() {
|
it("delegates custom equality testers, if present", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equals').andReturn(true)
|
equals: jasmine.createSpy('delegated-equals').andReturn(true)
|
||||||
},
|
},
|
||||||
customEqualityTesters = ['a', 'b'],
|
customEqualityTesters = ['a', 'b'],
|
||||||
matcher = j$.matchers.toEqual(util, customEqualityTesters),
|
matcher = j$.matchers.toEqual(util, customEqualityTesters),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
describe("toHaveBeenCalled", function() {
|
describe("toHaveBeenCalled", function() {
|
||||||
it("passes when the actual was called, with a custom .not fail message", function() {
|
it("passes when the actual was called, with a custom .not fail message", function() {
|
||||||
var matcher = j$.matchers.toHaveBeenCalled(),
|
var matcher = j$.matchers.toHaveBeenCalled(),
|
||||||
calledSpy = j$.createSpy('called-spy'),
|
calledSpy = jasmine.createSpy('called-spy'),
|
||||||
result;
|
result;
|
||||||
|
|
||||||
calledSpy();
|
calledSpy();
|
||||||
@@ -13,7 +13,7 @@ describe("toHaveBeenCalled", function() {
|
|||||||
|
|
||||||
it("fails when the actual was not called", function() {
|
it("fails when the actual was not called", function() {
|
||||||
var matcher = j$.matchers.toHaveBeenCalled(),
|
var matcher = j$.matchers.toHaveBeenCalled(),
|
||||||
uncalledSpy = j$.createSpy('uncalled spy');
|
uncalledSpy = jasmine.createSpy('uncalled spy');
|
||||||
|
|
||||||
result = matcher.compare(uncalledSpy);
|
result = matcher.compare(uncalledSpy);
|
||||||
expect(result.pass).toBe(false);
|
expect(result.pass).toBe(false);
|
||||||
@@ -28,14 +28,14 @@ describe("toHaveBeenCalled", function() {
|
|||||||
|
|
||||||
it("throws an exception when invoked with any arguments", function() {
|
it("throws an exception when invoked with any arguments", function() {
|
||||||
var matcher = j$.matchers.toHaveBeenCalled(),
|
var matcher = j$.matchers.toHaveBeenCalled(),
|
||||||
spy = j$.createSpy('sample spy');
|
spy = jasmine.createSpy('sample spy');
|
||||||
|
|
||||||
expect(function() { matcher.compare(spy, 'foo') }).toThrow(new Error("toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith"));
|
expect(function() { matcher.compare(spy, 'foo') }).toThrow(new Error("toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has a custom message on failure", function() {
|
it("has a custom message on failure", function() {
|
||||||
var matcher = j$.matchers.toHaveBeenCalled(),
|
var matcher = j$.matchers.toHaveBeenCalled(),
|
||||||
spy = j$.createSpy('sample-spy'),
|
spy = jasmine.createSpy('sample-spy'),
|
||||||
result;
|
result;
|
||||||
|
|
||||||
result = matcher.compare(spy);
|
result = matcher.compare(spy);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
describe("toHaveBeenCalledWith", function() {
|
describe("toHaveBeenCalledWith", function() {
|
||||||
it("passes when the actual was called with matching parameters", function() {
|
it("passes when the actual was called with matching parameters", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: j$.createSpy('delegated-contains').andReturn(true)
|
contains: jasmine.createSpy('delegated-contains').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
||||||
calledSpy = j$.createSpy('called-spy'),
|
calledSpy = jasmine.createSpy('called-spy'),
|
||||||
result;
|
result;
|
||||||
|
|
||||||
calledSpy('a', 'b');
|
calledSpy('a', 'b');
|
||||||
@@ -15,10 +15,10 @@ describe("toHaveBeenCalledWith", function() {
|
|||||||
|
|
||||||
it("fails when the actual was not called", function() {
|
it("fails when the actual was not called", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: j$.createSpy('delegated-contains').andReturn(false)
|
contains: jasmine.createSpy('delegated-contains').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
||||||
uncalledSpy = j$.createSpy('uncalled spy'),
|
uncalledSpy = jasmine.createSpy('uncalled spy'),
|
||||||
result;
|
result;
|
||||||
|
|
||||||
result = matcher.compare(uncalledSpy);
|
result = matcher.compare(uncalledSpy);
|
||||||
@@ -27,10 +27,10 @@ describe("toHaveBeenCalledWith", function() {
|
|||||||
|
|
||||||
it("fails when the actual was called with different parameters", function() {
|
it("fails when the actual was called with different parameters", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: j$.createSpy('delegated-contains').andReturn(false)
|
contains: jasmine.createSpy('delegated-contains').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
||||||
calledSpy = j$.createSpy('called spy'),
|
calledSpy = jasmine.createSpy('called spy'),
|
||||||
result;
|
result;
|
||||||
|
|
||||||
calledSpy('a');
|
calledSpy('a');
|
||||||
@@ -48,7 +48,7 @@ describe("toHaveBeenCalledWith", function() {
|
|||||||
|
|
||||||
it("has a custom message on failure", function() {
|
it("has a custom message on failure", function() {
|
||||||
var matcher = j$.matchers.toHaveBeenCalledWith(),
|
var matcher = j$.matchers.toHaveBeenCalledWith(),
|
||||||
spy = j$.createSpy('sample-spy'),
|
spy = jasmine.createSpy('sample-spy'),
|
||||||
messages = matcher.message(spy);
|
messages = matcher.message(spy);
|
||||||
|
|
||||||
expect(messages.affirmative).toEqual("Expected spy sample-spy to have been called.")
|
expect(messages.affirmative).toEqual("Expected spy sample-spy to have been called.")
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is an Error and the expected the same Error", function() {
|
it("passes if thrown is an Error and the expected the same Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -160,7 +160,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is a custom error that takes arguments and the expected is the same error", function() {
|
it("passes if thrown is a custom error that takes arguments and the expected is the same error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
CustomError = function CustomError(arg) { arg.x },
|
CustomError = function CustomError(arg) { arg.x },
|
||||||
@@ -180,7 +180,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("fails if thrown is an Error and the expected is a different Error", function() {
|
it("fails if thrown is an Error and the expected is a different Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(false)
|
equals: jasmine.createSpy('delegated-equal').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -196,7 +196,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is an Error and it is equal to the expected Error and message", function() {
|
it("passes if thrown is an Error and it is equal to the expected Error and message", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -212,7 +212,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message", function() {
|
it("passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
CustomError = function CustomError(arg) { this.message = arg.message },
|
CustomError = function CustomError(arg) { this.message = arg.message },
|
||||||
@@ -232,7 +232,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("fails if thrown is an Error and the expected is a different Error", function() {
|
it("fails if thrown is an Error and the expected is a different Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(false)
|
equals: jasmine.createSpy('delegated-equal').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -248,7 +248,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is an Error and has the same type as the expected Error and the message matches the exepcted message", function() {
|
it("passes if thrown is an Error and has the same type as the expected Error and the message matches the exepcted message", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -264,7 +264,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("fails if thrown is an Error and the expected is a different Error", function() {
|
it("fails if thrown is an Error and the expected is a different Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(false)
|
equals: jasmine.createSpy('delegated-equal').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("passes if it throws but there is no expected", function() {
|
it("passes if it throws but there is no expected", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -50,7 +50,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("passes if what is thrown is equivalent to what is expected", function() {
|
it("passes if what is thrown is equivalent to what is expected", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(true)
|
equals: jasmine.createSpy('delegated-equal').andReturn(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -66,7 +66,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("fails if what is thrown is not equivalent to what is expected", function() {
|
it("fails if what is thrown is not equivalent to what is expected", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(false)
|
equals: jasmine.createSpy('delegated-equal').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -82,7 +82,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("fails if what is thrown is not equivalent to undefined", function() {
|
it("fails if what is thrown is not equivalent to undefined", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: j$.createSpy('delegated-equal').andReturn(false)
|
equals: jasmine.createSpy('delegated-equal').andReturn(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user