mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-03 12:44:43 +00:00
fix(ngScenario): fix error message description
This commit is contained in:
parent
6c59e77008
commit
f8f8f754b0
1 changed files with 5 additions and 4 deletions
|
|
@ -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 = angular.scenario.matcher || function(name, fn) {
|
||||||
angular.scenario.matcher[name] = function(expected) {
|
angular.scenario.matcher[name] = function(expected) {
|
||||||
var prefix = 'expect ' + this.future.name + ' ',
|
var description = this.future.name +
|
||||||
not = this.inverse && 'not ';
|
(this.inverse ? ' not ' : ' ') + name +
|
||||||
|
' ' + angular.toJson(expected);
|
||||||
var self = this;
|
var self = this;
|
||||||
this.addFuture(prefix + not + name + ' ' + angular.toJson(expected),
|
this.addFuture('expect ' + description,
|
||||||
function(done) {
|
function(done) {
|
||||||
var error;
|
var error;
|
||||||
self.actual = self.future.value;
|
self.actual = self.future.value;
|
||||||
if ((self.inverse && fn.call(self, expected)) ||
|
if ((self.inverse && fn.call(self, expected)) ||
|
||||||
(!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);
|
' but was ' + angular.toJson(self.actual);
|
||||||
}
|
}
|
||||||
done(error);
|
done(error);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue