Files
jasmine/spec/core/matchers/toContainSpec.js
Sheel Choksi 9c7ba43ebd Clean up a bunch of spec global variable leaks
Also some formatting changes to highlight when using one 'var' with comma operator
2014-01-18 14:17:14 -08:00

27 lines
899 B
JavaScript

describe("toContain", function() {
it("delegates to j$.matchersUtil.contains", function() {
var util = {
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
},
matcher = j$.matchers.toContain(util),
result;
result = matcher.compare("ABC", "B");
expect(util.contains).toHaveBeenCalledWith("ABC", "B", []);
expect(result.pass).toBe(true);
});
it("delegates to j$.matchersUtil.contains, passing in equality testers if present", function() {
var util = {
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
},
customEqualityTesters = ['a', 'b'],
matcher = j$.matchers.toContain(util, customEqualityTesters),
result;
result = matcher.compare("ABC", "B");
expect(util.contains).toHaveBeenCalledWith("ABC", "B", ['a', 'b']);
expect(result.pass).toBe(true);
});
});