Fixed objectContaining to not match when the expected is the empty object and the actual is a non-object
This commit is contained in:
@@ -30,7 +30,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
|
||||
ObjectContaining.prototype.asymmetricMatch = function(other, customTesters) {
|
||||
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
|
||||
// TODO: This succeeds when sample is an empty object and other is a non-object, but should probably fail
|
||||
if (typeof(other) !== 'object') { return false; }
|
||||
|
||||
for (var property in this.sample) {
|
||||
if (!hasProperty(other, property) ||
|
||||
|
||||
Reference in New Issue
Block a user