lib/jspec.js in jspec-2.11.10 vs lib/jspec.js in jspec-2.11.12
- old
+ new
@@ -3,11 +3,11 @@
(function(){
JSpec = {
- version : '2.11.10',
+ version : '2.11.12',
cache : {},
suites : [],
modules : [],
allSuites : [],
matchers : {},
@@ -158,11 +158,13 @@
(spec.requiresImplementation() ?
'<td class="requires-implementation" colspan="2">' + escape(spec.description) + '</td>' :
(spec.passed() && !failuresOnly) ?
'<td class="pass">' + escape(spec.description)+ '</td><td>' + spec.assertionsGraph() + '</td>' :
!spec.passed() ?
- '<td class="fail">' + escape(spec.description) + ' <em>' + escape(spec.failure().message) + '</em>' + '</td><td>' + spec.assertionsGraph() + '</td>' :
+ '<td class="fail">' + escape(spec.description) +
+ map(spec.failures(), function(a){ return '<em>' + escape(a.message) + '</em>' }).join('') +
+ '</td><td>' + spec.assertionsGraph() + '</td>' :
'') +
'<tr class="body"><td colspan="2"><pre>' + bodyContents(spec.body) + '</pre></td></tr>'
}).join('') + '</tr>'
}).join('') + '</table></div>'
},
@@ -194,11 +196,11 @@
print(color(' ' + spec.description, 'blue') + assertionsGraph)
else if (spec.passed() && !failuresOnly)
print(color(' ' + spec.description, 'green') + assertionsGraph)
else if (!spec.passed())
print(color(' ' + spec.description, 'red') + assertionsGraph +
- "\n" + indent(spec.failure().message) + "\n")
+ "\n" + indent(map(spec.failures(), function(a){ return a.message }).join("\n")) + "\n")
})
print("")
}
})
@@ -397,11 +399,11 @@
if (this.expectedArgs && (negate ? !this.expectedResult && this.anyArgsPass() : this.anyArgsFail()))
this.message = methodString + ' to be called with ' + puts.apply(this, this.expectedArgs) +
' but was' + (negate ? '' : ' called with ' + puts.apply(this, this.failingArgs()))
- if (negate ? !this.expectedResult && !this.expectedArgs && this.calls.length == this.times : this.calls.length != this.times)
+ if (negate ? !this.expectedResult && !this.expectedArgs && this.calls.length >= this.times : this.calls.length != this.times)
this.message = methodString + ' to be called ' + times(this.times) +
', but ' + (this.calls.length == 0 ? ' was not called' : ' was called ' + times(this.calls.length))
if (!this.message.length)
this.passed = true
@@ -1338,23 +1340,23 @@
preprocess : function(input) {
if (typeof input != 'string') return
input = hookImmutable('preprocessing', input)
return input.
- replace(/\t/gm, ' ').
- replace(/\r\n|\n|\r/gm, '\n').
+ replace(/\t/g, ' ').
+ replace(/\r\n|\n|\r/g, '\n').
+ replace(/__END__[^]*/, '').
replace(/([\w\.]+)\.(stub|destub)\((.*?)\)$/gm, '$2($1, $3)').
replace(/describe\s+(.*?)$/gm, 'describe($1, function(){').
replace(/^\s+it\s+(.*?)$/gm, ' it($1, function(){').
replace(/^ *(before_each|after_each|before|after)(?= |\n|$)/gm, 'JSpec.currentSuite.addHook("$1", function(){').
replace(/^\s*end(?=\s|$)/gm, '});').
replace(/-\{/g, 'function(){').
replace(/(\d+)\.\.(\d+)/g, function(_, a, b){ return range(a, b) }).
replace(/\.should([_\.]not)?[_\.](\w+)(?: |;|$)(.*)$/gm, '.should$1_$2($3)').
replace(/([\/\s]*)(.+?)\.(should(?:[_\.]not)?)[_\.](\w+)\((.*)\)\s*;?$/gm, '$1 expect($2).$3($4, $5)').
- replace(/, \)/gm, ')').
- replace(/should\.not/gm, 'should_not').
- replace(/__END__.*/m, '')
+ replace(/, \)/g, ')').
+ replace(/should\.not/g, 'should_not')
},
/**
* Create a range string which can be evaluated to a native array.
*
\ No newline at end of file