From f8f8f754b02459bb789247476cc0da63d2d7370f Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Wed, 25 Sep 2013 09:46:32 +0100 Subject: [PATCH] fix(ngScenario): fix error message description --- src/ngScenario/Scenario.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ngScenario/Scenario.js b/src/ngScenario/Scenario.js index 36cc7c0c3354..dda9a9e302fe 100644 --- a/src/ngScenario/Scenario.js +++ b/src/ngScenario/Scenario.js @@ -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);