small refactoring

This commit is contained in:
John Bintz 2011-05-15 22:42:02 -04:00
parent fd3e8218d7
commit 9715eb3a2e
2 changed files with 7 additions and 5 deletions

View File

@ -27,12 +27,13 @@ class jasmine.HeadlessReporter
reportRunnerStarting: (runner) -> reportRunnerStarting: (runner) ->
@startTime = new Date() @startTime = new Date()
reportSpecResults: (spec) -> reportSpecResults: (spec) ->
if spec.results().passed() results = spec.results()
if results.passed()
JHW.specPassed() JHW.specPassed()
else else
JHW.specFailed() JHW.specFailed()
failureResult = new HeadlessReporterResult(spec.getFullName()) failureResult = new HeadlessReporterResult(spec.getFullName())
for result in spec.results().getItems() for result in results.getItems()
do (result) => do (result) =>
if result.type == 'expect' and !result.passed_ if result.type == 'expect' and !result.passed_
@failedCount += 1 @failedCount += 1

View File

@ -49,13 +49,14 @@
return this.startTime = new Date(); return this.startTime = new Date();
}; };
HeadlessReporter.prototype.reportSpecResults = function(spec) { HeadlessReporter.prototype.reportSpecResults = function(spec) {
var failureResult, result, _fn, _i, _len, _ref; var failureResult, result, results, _fn, _i, _len, _ref;
if (spec.results().passed()) { results = spec.results();
if (results.passed()) {
return JHW.specPassed(); return JHW.specPassed();
} else { } else {
JHW.specFailed(); JHW.specFailed();
failureResult = new HeadlessReporterResult(spec.getFullName()); failureResult = new HeadlessReporterResult(spec.getFullName());
_ref = spec.results().getItems(); _ref = results.getItems();
_fn = __bind(function(result) { _fn = __bind(function(result) {
if (result.type === 'expect' && !result.passed_) { if (result.type === 'expect' && !result.passed_) {
this.failedCount += 1; this.failedCount += 1;