diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/scenario/Future.js | 22 | ||||
| -rw-r--r-- | src/scenario/Matcher.js | 42 | ||||
| -rw-r--r-- | src/scenario/Runner.js | 6 |
3 files changed, 24 insertions, 46 deletions
diff --git a/src/scenario/Future.js b/src/scenario/Future.js index 6c90df9d..d70e8e6e 100644 --- a/src/scenario/Future.js +++ b/src/scenario/Future.js @@ -11,25 +11,3 @@ Future.prototype = { this.value = value; } }; - -function Matcher(future, logger) { - var self = 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', function(a,b){ return a == b; }); diff --git a/src/scenario/Matcher.js b/src/scenario/Matcher.js index dd7b7ee6..a4a13285 100644 --- a/src/scenario/Matcher.js +++ b/src/scenario/Matcher.js @@ -1,21 +1,21 @@ -//function Matcher(future, logger) { -// var self = 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', function(a,b){ return a == b; }); +function Matcher(future, logger) { + var self = 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', function(a,b){ return a == b; }); diff --git a/src/scenario/Runner.js b/src/scenario/Runner.js index 3fc1c614..4e5d0f01 100644 --- a/src/scenario/Runner.js +++ b/src/scenario/Runner.js @@ -22,9 +22,9 @@ angular.scenario.Runner = function(scope, jQuery){ this.scope.afterEach = function(body) { afterEach = body; }; -// this.scope.expect = function(future) { -// return new Matcher(future, self.logger); -// }; + this.scope.expect = function(future) { + return new Matcher(future, self.logger); + }; this.scope.it = function(name, body) { var specName = path.join(' ') + ': it ' + name; self.currentSpec = specs[specName] = { |
