Sha256: 8fd99fd63ad9eb9dc079798d6a38bcbd233a02449b5e7eaa04e30d4f6e79352c
Contents?: true
Size: 1.38 KB
Versions: 40
Compression:
Stored size: 1.38 KB
Contents
getJasmineRequireObj().ObjectContaining = function(j$) { function ObjectContaining(sample) { this.sample = sample; } ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) { if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); } mismatchKeys = mismatchKeys || []; mismatchValues = mismatchValues || []; var hasKey = function(obj, keyName) { return obj !== null && !j$.util.isUndefined(obj[keyName]); }; for (var property in this.sample) { if (!hasKey(other, property) && hasKey(this.sample, property)) { mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.'); } else if (!j$.matchersUtil.equals(other[property], this.sample[property])) { mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + '\' in actual, but was \'' + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in expected.'); } } return (mismatchKeys.length === 0 && mismatchValues.length === 0); }; ObjectContaining.prototype.jasmineToString = function() { return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>'; }; return ObjectContaining; };
Version data entries
40 entries across 40 versions & 2 rubygems