11var should = require ( 'should' ) ;
22var helper = require ( '../support/spec_helper' ) ;
33var ORM = require ( '../../' ) ;
4+ var common = require ( '../common' ) ;
5+
6+ if ( common . protocol ( ) == "mongodb" ) {
7+ process . exit ( 0 ) ;
8+ }
49
510describe ( "LazyLoad properties" , function ( ) {
611 var db = null ;
@@ -42,11 +47,11 @@ describe("LazyLoad properties", function() {
4247 before ( setup ( ) ) ;
4348
4449 it ( "should not be available when fetching an instance" , function ( done ) {
45- Person . get ( 1 , function ( err , John ) {
50+ Person . find ( ) . first ( function ( err , John ) {
4651 should . equal ( err , null ) ;
4752
4853 John . should . be . a ( "object" ) ;
49- John . should . have . property ( "id" , 1 ) ;
54+
5055 John . should . have . property ( "name" , "John Doe" ) ;
5156 John . should . have . property ( "photo" , null ) ;
5257
@@ -55,7 +60,7 @@ describe("LazyLoad properties", function() {
5560 } ) ;
5661
5762 it ( "should have apropriate accessors" , function ( done ) {
58- Person . get ( 1 , function ( err , John ) {
63+ Person . find ( ) . first ( function ( err , John ) {
5964 should . equal ( err , null ) ;
6065
6166 John . should . be . a ( "object" ) ;
@@ -68,7 +73,7 @@ describe("LazyLoad properties", function() {
6873 } ) ;
6974
7075 it ( "getAccessor should return property" , function ( done ) {
71- Person . get ( 1 , function ( err , John ) {
76+ Person . find ( ) . first ( function ( err , John ) {
7277 should . equal ( err , null ) ;
7378
7479 John . should . be . a ( "object" ) ;
@@ -83,7 +88,7 @@ describe("LazyLoad properties", function() {
8388 } ) ;
8489
8590 it ( "setAccessor should change property" , function ( done ) {
86- Person . get ( 1 , function ( err , John ) {
91+ Person . find ( ) . first ( function ( err , John ) {
8792 should . equal ( err , null ) ;
8893
8994 John . should . be . a ( "object" ) ;
@@ -108,15 +113,15 @@ describe("LazyLoad properties", function() {
108113 } ) ;
109114
110115 it ( "removeAccessor should change property" , function ( done ) {
111- Person . get ( 1 , function ( err , John ) {
116+ Person . find ( ) . first ( function ( err , John ) {
112117 should . equal ( err , null ) ;
113118
114119 John . should . be . a ( "object" ) ;
115120
116121 John . removePhoto ( function ( err ) {
117122 should . equal ( err , null ) ;
118123
119- Person . get ( 1 , function ( err , John ) {
124+ Person . get ( John [ Person . id ] , function ( err , John ) {
120125 should . equal ( err , null ) ;
121126
122127 John . should . be . a ( "object" ) ;
0 commit comments