1
0
Fork 0

Foxx.Repository#updateByExample

This commit is contained in:
Lucas Dohmen 2014-06-18 15:28:00 +02:00
parent 94e2d0e9a4
commit 473566a4e2
2 changed files with 16 additions and 1 deletions

View File

@ -403,6 +403,10 @@ _.extend(Repository.prototype, {
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
updateByExample: function (example, updates) {
'use strict';
this.collection.updateByExample(example, updates);
},
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SUBSECTION-- Counting Entries // --SUBSECTION-- Counting Entries

View File

@ -73,6 +73,7 @@ describe('Repository Methods', function () {
'firstExample', 'firstExample',
'remove', 'remove',
'removeByExample', 'removeByExample',
'updateByExample',
'replace', 'replace',
'replaceByExample' 'replaceByExample'
]); ]);
@ -250,7 +251,17 @@ describe('Repository Methods', function () {
describe('for updating entries', function () { describe('for updating entries', function () {
it('should update by id'); it('should update by id');
it('should update by example');
it('should update by example', function () {
var example = createSpy('example'),
updates = createSpy('updates'),
idAndRev = createSpy('idAndRev');
collection.updateByExample.and.returnValue(idAndRev);
instance.updateByExample(example, updates);
expect(collection.updateByExample.calls.argsFor(0)).toEqual([example, updates]);
});
}); });
describe('for counting entries', function () { describe('for counting entries', function () {