diff options
| author | Igor Minar | 2011-12-15 01:10:09 -0800 |
|---|---|---|
| committer | Igor Minar | 2012-01-23 22:33:28 -0800 |
| commit | ed78f0d830b22eb8f280e841cde6287b678fc914 (patch) | |
| tree | 4f7fbc6147126d349f7b5f585adcd6378bbd6ab1 /test/matchers.js | |
| parent | dbffbefb7cd7af2ac063c95378a035aa9fbbd2ff (diff) | |
| download | angular.js-ed78f0d830b22eb8f280e841cde6287b678fc914.tar.bz2 | |
chore(log): generic test log service with custom toEquals matcher
- any test that needs a logger can just inject provideLog
- logger has susict api that makes tests more readable
- custom toEquals matcher allows for pretty expectations
Diffstat (limited to 'test/matchers.js')
| -rw-r--r-- | test/matchers.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/matchers.js b/test/matchers.js index 1e0ae92a..fd706d3c 100644 --- a/test/matchers.js +++ b/test/matchers.js @@ -36,6 +36,15 @@ beforeEach(function() { toBeDirty: cssMatcher('ng-dirty', 'ng-pristine'), toBePristine: cssMatcher('ng-pristine', 'ng-dirty'), + toEqual: function(expected) { + if (this.actual && this.actual.$$log) { + this.actual = (typeof expected === 'string') + ? this.actual.toString() + : this.actual.toArray(); + } + return jasmine.Matchers.prototype.toEqual.call(this, expected); + }, + toEqualData: function(expected) { return angular.equals(this.actual, expected); }, |
