diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index fd653ebc..3f0639bd 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -936,7 +936,7 @@ getJasmineRequireObj().Any = function() { this.expectedObject = expectedObject; } - Any.prototype.jasmineMatches = function(other) { + Any.prototype.asymmetricMatch = function(other) { if (this.expectedObject == String) { return typeof other == 'string' || other instanceof String; } @@ -1549,7 +1549,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) { this.sample = sample; } - ObjectContaining.prototype.jasmineMatches = function(other) { + ObjectContaining.prototype.asymmetricMatch = function(other) { if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); } var hasKey = function(obj, keyName) { @@ -2252,15 +2252,15 @@ getJasmineRequireObj().matchersUtil = function(j$) { } if (a instanceof j$.Any) { - return a.jasmineMatches(b); + return a.asymmetricMatch(b); } if (b instanceof j$.Any) { - return b.jasmineMatches(a); + return b.asymmetricMatch(a); } if (b instanceof j$.ObjectContaining) { - return b.jasmineMatches(a); + return b.asymmetricMatch(a); } if (a instanceof Error && b instanceof Error) { diff --git a/spec/core/AnySpec.js b/spec/core/AnySpec.js index 139a4133..fc485d41 100644 --- a/spec/core/AnySpec.js +++ b/spec/core/AnySpec.js @@ -2,38 +2,38 @@ describe("Any", function() { it("matches a string", function() { var any = new j$.Any(String); - expect(any.jasmineMatches("foo")).toBe(true); + expect(any.asymmetricMatch("foo")).toBe(true); }); it("matches a number", function() { var any = new j$.Any(Number); - expect(any.jasmineMatches(1)).toBe(true); + expect(any.asymmetricMatch(1)).toBe(true); }); it("matches a function", function() { var any = new j$.Any(Function); - expect(any.jasmineMatches(function(){})).toBe(true); + expect(any.asymmetricMatch(function(){})).toBe(true); }); it("matches an Object", function() { var any = new j$.Any(Object); - expect(any.jasmineMatches({})).toBe(true); + expect(any.asymmetricMatch({})).toBe(true); }); it("matches a Boolean", function() { var any = new j$.Any(Boolean); - expect(any.jasmineMatches(true)).toBe(true); + expect(any.asymmetricMatch(true)).toBe(true); }); it("matches another constructed object", function() { var Thing = function() {}, any = new j$.Any(Thing); - expect(any.jasmineMatches(new Thing())).toBe(true); + expect(any.asymmetricMatch(new Thing())).toBe(true); }); it("jasmineToString's itself", function() { diff --git a/spec/core/ObjectContainingSpec.js b/spec/core/ObjectContainingSpec.js index 8102bdfb..0bdb2e5b 100644 --- a/spec/core/ObjectContainingSpec.js +++ b/spec/core/ObjectContainingSpec.js @@ -3,33 +3,33 @@ describe("ObjectContaining", function() { it("matches any actual to an empty object", function() { var containing = new j$.ObjectContaining({}); - expect(containing.jasmineMatches("foo")).toBe(true); + expect(containing.asymmetricMatch("foo")).toBe(true); }); it("does not match an empty object actual", function() { var containing = new j$.ObjectContaining("foo"); expect(function() { - containing.jasmineMatches({}) + containing.asymmetricMatch({}) }).toThrowError(/not 'foo'/) }); it("matches when the key/value pair is present in the actual", function() { var containing = new j$.ObjectContaining({foo: "fooVal"}); - expect(containing.jasmineMatches({foo: "fooVal", bar: "barVal"})).toBe(true); + expect(containing.asymmetricMatch({foo: "fooVal", bar: "barVal"})).toBe(true); }); it("does not match when the key/value pair is not present in the actual", function() { var containing = new j$.ObjectContaining({foo: "fooVal"}); - expect(containing.jasmineMatches({bar: "barVal", quux: "quuxVal"})).toBe(false); + expect(containing.asymmetricMatch({bar: "barVal", quux: "quuxVal"})).toBe(false); }); it("does not match when the key is present but the value is different in the actual", function() { var containing = new j$.ObjectContaining({foo: "other"}); - expect(containing.jasmineMatches({foo: "fooVal", bar: "barVal"})).toBe(false); + expect(containing.asymmetricMatch({foo: "fooVal", bar: "barVal"})).toBe(false); }); it("jasmineToString's itself", function() { @@ -41,6 +41,6 @@ describe("ObjectContaining", function() { it("matches recursively", function() { var containing = new j$.ObjectContaining({one: new j$.ObjectContaining({two: {}})}); - expect(containing.jasmineMatches({one: {two: {}}})).toBe(true); + expect(containing.asymmetricMatch({one: {two: {}}})).toBe(true); }); }); diff --git a/src/core/Any.js b/src/core/Any.js index 62992ecb..388ba22e 100644 --- a/src/core/Any.js +++ b/src/core/Any.js @@ -4,7 +4,7 @@ getJasmineRequireObj().Any = function() { this.expectedObject = expectedObject; } - Any.prototype.jasmineMatches = function(other) { + Any.prototype.asymmetricMatch = function(other) { if (this.expectedObject == String) { return typeof other == 'string' || other instanceof String; } diff --git a/src/core/ObjectContaining.js b/src/core/ObjectContaining.js index 5fcb77ca..89b8489d 100644 --- a/src/core/ObjectContaining.js +++ b/src/core/ObjectContaining.js @@ -4,7 +4,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) { this.sample = sample; } - ObjectContaining.prototype.jasmineMatches = function(other) { + ObjectContaining.prototype.asymmetricMatch = function(other) { if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); } var hasKey = function(obj, keyName) { diff --git a/src/core/matchers/matchersUtil.js b/src/core/matchers/matchersUtil.js index f58331fd..241cb472 100644 --- a/src/core/matchers/matchersUtil.js +++ b/src/core/matchers/matchersUtil.js @@ -64,15 +64,15 @@ getJasmineRequireObj().matchersUtil = function(j$) { } if (a instanceof j$.Any) { - return a.jasmineMatches(b); + return a.asymmetricMatch(b); } if (b instanceof j$.Any) { - return b.jasmineMatches(a); + return b.asymmetricMatch(a); } if (b instanceof j$.ObjectContaining) { - return b.jasmineMatches(a); + return b.asymmetricMatch(a); } if (a instanceof Error && b instanceof Error) {