blob: a9c8657125c9764cfd3ece121cffd4d12a757589 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
function Matcher(scope, future, logger) {
var self = scope.$scenario = this;
this.logger = logger;
this.future = future;
}
Matcher.addMatcher = function(name, matcher) {
Matcher.prototype[name] = function(expected) {
var future = this.future;
$scenario.addFuture(
'expect ' + future.name + ' ' + name + ' ' + expected,
function(done){
if (!matcher(future.value, expected))
throw "Expected " + expected + ' but was ' + future.value;
done();
}
);
};
};
Matcher.addMatcher('toEqual', angular.equals);
|