This repository was archived by the owner on Feb 15, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,9 @@ var should = require('should'),
7
7
sinon = require ( 'sinon' ) ,
8
8
mockery = require ( 'mockery' ) ;
9
9
10
- mongoose . connect ( 'mongodb://localhost/test' ) ;
11
-
12
- Function . prototype . promisify = function ( ctx ) {
13
- var args = Array . prototype . slice . call ( arguments , 1 ) ;
10
+ require ( '../utils/promise' ) ;
14
11
15
- var fn = Promise . denodeify ( this ) ;
16
- return fn . apply ( ctx , args ) ;
17
- } ;
12
+ mongoose . connect ( 'mongodb://localhost/test' ) ;
18
13
19
14
var userSchema = new Schema ( {
20
15
name : String ,
@@ -332,7 +327,7 @@ describe('Backend', function () {
332
327
tweet2 . createActivity ( )
333
328
] ;
334
329
335
- return backend . enrichActivities ( activities )
330
+ return backend . enrichActivities ( activities ) ;
336
331
} )
337
332
. then ( function ( enriched ) {
338
333
enriched . should . length ( 2 ) ;
Original file line number Diff line number Diff line change
1
+ var Promise = require ( 'promise' ) ;
2
+
3
+ /**
4
+ * Use this monkey patch to enable promises on
5
+ * mongoose methods
6
+ */
7
+ Function . prototype . promisify = function ( ctx ) {
8
+ var args = Array . prototype . slice . call ( arguments , 1 ) ;
9
+
10
+ var fn = Promise . denodeify ( this ) ;
11
+ return fn . apply ( ctx , args ) ;
12
+ } ;
You can’t perform that action at this time.
0 commit comments