@@ -134,7 +134,13 @@ describe("Hook", function() {
134134 items . should . have . property ( "length" , 1 ) ;
135135 items [ 0 ] . name . should . equal ( "Jane Doe" ) ;
136136
137- return done ( ) ;
137+ // ensure it was really saved
138+ Person . get ( items [ 0 ] . id , function ( err , Item ) {
139+ should . equal ( err , null ) ;
140+ Item . name . should . equal ( "Jane Doe" ) ;
141+
142+ return done ( ) ;
143+ } ) ;
138144 } ) ;
139145 } ) ;
140146 } ) ;
@@ -212,6 +218,32 @@ describe("Hook", function() {
212218 } ) ;
213219 } ) ;
214220
221+ describe ( "when setting properties" , function ( ) {
222+ before ( setup ( {
223+ beforeSave : function ( ) {
224+ this . name = "Jane Doe" ;
225+ }
226+ } ) ) ;
227+
228+ it ( "should not be discarded" , function ( done ) {
229+ Person . create ( [ { } ] , function ( err , items ) {
230+ should . equal ( err , null ) ;
231+
232+ items . should . be . a ( "object" ) ;
233+ items . should . have . property ( "length" , 1 ) ;
234+ items [ 0 ] . name . should . equal ( "Jane Doe" ) ;
235+
236+ // ensure it was really saved
237+ Person . get ( items [ 0 ] . id , function ( err , Item ) {
238+ should . equal ( err , null ) ;
239+ Item . name . should . equal ( "Jane Doe" ) ;
240+
241+ return done ( ) ;
242+ } ) ;
243+ } ) ;
244+ } ) ;
245+ } ) ;
246+
215247 describe ( "if hook method has 1 argument" , function ( ) {
216248 var beforeSave = false ;
217249
0 commit comments