diff options
| author | Andres Ornelas | 2010-08-04 12:36:53 -0700 |
|---|---|---|
| committer | Andres Ornelas | 2010-08-04 12:36:53 -0700 |
| commit | 6d0eeda1e231d0fbe515ce4cea8bf6245e1b72d3 (patch) | |
| tree | 530a9f5ab052d0fa1aec9b90778c04698ea5d547 | |
| parent | 26ed747588d2e7bceddcb4ccd9bacd5f51b9fec8 (diff) | |
| download | angular.js-6d0eeda1e231d0fbe515ce4cea8bf6245e1b72d3.tar.bz2 | |
added MatcherSpec
| -rw-r--r-- | src/scenario/Matcher.js | 1 | ||||
| -rw-r--r-- | test/scenario/MatcherSpec.js | 30 |
2 files changed, 30 insertions, 1 deletions
diff --git a/src/scenario/Matcher.js b/src/scenario/Matcher.js index 326bb948..62f094c8 100644 --- a/src/scenario/Matcher.js +++ b/src/scenario/Matcher.js @@ -15,7 +15,6 @@ Matcher.addMatcher = function(name, matcher) { done(); } ); - dump('future added'); }; }; diff --git a/test/scenario/MatcherSpec.js b/test/scenario/MatcherSpec.js new file mode 100644 index 00000000..c47f0c25 --- /dev/null +++ b/test/scenario/MatcherSpec.js @@ -0,0 +1,30 @@ +describe('Matcher', function () { + function executeFutures() { + for(var i in $scenario.currentSpec.futures) { + var future = $scenario.currentSpec.futures[i]; + future.behavior.call({}, function(value) { future.fulfill(value); }); + } + } + var matcher; + beforeEach(function() { + setUpContext(); + var future = $scenario.addFuture('Calculate first future', function(done) { + done(123); + }); + matcher = new Matcher(this, future); + + }); + it('should correctly match toEqual', function() { + matcher.toEqual(123); + executeFutures(); + }); + it('should throw an error when incorrect match toEqual', function() { + matcher.toEqual(456); + try { + executeFutures(); + fail(); + } catch (e) { + expect(e).toEqual('Expected 456 but was 123'); + } + }); +});
\ No newline at end of file |
