From e83d05d3b2d90d46e32fa96b92cd5b148fad6d3e Mon Sep 17 00:00:00 2001 From: Lucas Dohmen Date: Wed, 18 Jun 2014 15:50:20 +0200 Subject: [PATCH] Foxx.Repository#count --- js/server/modules/org/arangodb/foxx/repository.js | 4 ++++ js/server/tests/shell-foxx-repository-spec.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/js/server/modules/org/arangodb/foxx/repository.js b/js/server/modules/org/arangodb/foxx/repository.js index a1b3230d69..aaa07958e5 100644 --- a/js/server/modules/org/arangodb/foxx/repository.js +++ b/js/server/modules/org/arangodb/foxx/repository.js @@ -429,6 +429,10 @@ _.extend(Repository.prototype, { /// ``` /// @endDocuBlock //////////////////////////////////////////////////////////////////////////////// + count: function () { + 'use strict'; + return this.collection.count(); + } }); Repository.extend = backbone_helpers.extend; diff --git a/js/server/tests/shell-foxx-repository-spec.js b/js/server/tests/shell-foxx-repository-spec.js index dc5257f55e..84212ceb4f 100644 --- a/js/server/tests/shell-foxx-repository-spec.js +++ b/js/server/tests/shell-foxx-repository-spec.js @@ -68,6 +68,7 @@ describe('Repository Methods', function () { collection = createSpyObj('collection', [ 'all', 'save', + 'count', 'document', 'byExample', 'firstExample', @@ -275,6 +276,10 @@ describe('Repository Methods', function () { }); describe('for counting entries', function () { - it('should count all'); + it('should count all', function () { + var count = createSpy('count'); + collection.count.and.returnValue(count); + expect(instance.count()).toBe(count); + }); }); });