Sha256: f787a4c5c8072450b8bebe420923c5498c6bc0ca9755154f92093bcf788833a7
Contents?: true
Size: 972 Bytes
Versions: 3
Compression:
Stored size: 972 Bytes
Contents
function callForEach(prop, func) { return function () { for (let i = 0, l = this[prop].length; i < l; i++) { this[prop][i][func](); } }; } export function buildCompositeAssert(assertClasses) { function Composite(env) { this.asserts = assertClasses.map(Assert => new Assert(env)); } Composite.prototype = { reset: callForEach('asserts', 'reset'), inject: callForEach('asserts', 'inject'), assert: callForEach('asserts', 'assert'), restore: callForEach('asserts', 'restore'), }; return Composite; } function noop() { } export function callWithStub(env, name, func, debugStub = noop) { let originalFunc = env.getDebugFunction(name); try { env.setDebugFunction(name, debugStub); func(); } finally { env.setDebugFunction(name, originalFunc); } } export function checkTest(test) { return typeof test === 'function' ? test() : test; }
Version data entries
3 entries across 3 versions & 1 rubygems