1
0
Fork 0

Foxx.Repository#count

This commit is contained in:
Lucas Dohmen 2014-06-18 15:50:20 +02:00
parent ca41f74a63
commit e83d05d3b2
2 changed files with 10 additions and 1 deletions

View File

@ -429,6 +429,10 @@ _.extend(Repository.prototype, {
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
count: function () {
'use strict';
return this.collection.count();
}
}); });
Repository.extend = backbone_helpers.extend; Repository.extend = backbone_helpers.extend;

View File

@ -68,6 +68,7 @@ describe('Repository Methods', function () {
collection = createSpyObj('collection', [ collection = createSpyObj('collection', [
'all', 'all',
'save', 'save',
'count',
'document', 'document',
'byExample', 'byExample',
'firstExample', 'firstExample',
@ -275,6 +276,10 @@ describe('Repository Methods', function () {
}); });
describe('for counting entries', 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);
});
}); });
}); });