Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(ngScenario): fix error message description
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin committed Sep 25, 2013
1 parent 6c59e77 commit f8f8f75
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ngScenario/Scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,17 @@ angular.scenario.dsl = angular.scenario.dsl || function(name, fn) {
*/
angular.scenario.matcher = angular.scenario.matcher || function(name, fn) {
angular.scenario.matcher[name] = function(expected) {
var prefix = 'expect ' + this.future.name + ' ',
not = this.inverse && 'not ';
var description = this.future.name +
(this.inverse ? ' not ' : ' ') + name +
' ' + angular.toJson(expected);
var self = this;
this.addFuture(prefix + not + name + ' ' + angular.toJson(expected),
this.addFuture('expect ' + description,
function(done) {
var error;
self.actual = self.future.value;
if ((self.inverse && fn.call(self, expected)) ||
(!self.inverse && !fn.call(self, expected))) {
error = 'expected ' + not + name + ' ' + angular.toJson(expected) +
error = 'expected ' + description +
' but was ' + angular.toJson(self.actual);
}
done(error);
Expand Down

0 comments on commit f8f8f75

Please sign in to comment.