@@ -1806,7 +1806,10 @@ describe('User', function() {
18061806
18071807 describe ( 'Password Reset' , function ( ) {
18081808 describe ( 'User.resetPassword(options, cb)' , function ( ) {
1809- 1809+ var options = {
1810+ 1811+ redirect : 'http://foobar.com/reset-password' ,
1812+ } ;
18101813
18111814 it ( 'Requires email address to reset password' , function ( done ) {
18121815 User . resetPassword ( { } , function ( err ) {
@@ -1840,11 +1843,27 @@ describe('User', function() {
18401843 } ) ;
18411844 } ) ;
18421845
1846+ it ( 'Checks that options exist' , function ( done ) {
1847+ var calledBack = false ;
1848+
1849+ User . resetPassword ( options , function ( ) {
1850+ calledBack = true ;
1851+ } ) ;
1852+
1853+ User . once ( 'resetPasswordRequest' , function ( info ) {
1854+ assert ( info . options ) ;
1855+ assert . equal ( info . options , options ) ;
1856+ assert ( calledBack ) ;
1857+
1858+ done ( ) ;
1859+ } ) ;
1860+ } ) ;
1861+
18431862 it ( 'Creates a temp accessToken to allow a user to change password' , function ( done ) {
18441863 var calledBack = false ;
18451864
18461865 User . resetPassword ( {
1847- email : email
1866+ email : options . email ,
18481867 } , function ( ) {
18491868 calledBack = true ;
18501869 } ) ;
@@ -1858,7 +1877,7 @@ describe('User', function() {
18581877 info . accessToken . user ( function ( err , user ) {
18591878 if ( err ) return done ( err ) ;
18601879
1861- assert . equal ( user . email , email ) ;
1880+ assert . equal ( user . email , options . email ) ;
18621881
18631882 done ( ) ;
18641883 } ) ;
@@ -1887,7 +1906,7 @@ describe('User', function() {
18871906 . post ( '/test-users/reset' )
18881907 . expect ( 'Content-Type' , / j s o n / )
18891908 . expect ( 204 )
1890- . send ( { email : email } )
1909+ . send ( { email : options . email } )
18911910 . end ( function ( err , res ) {
18921911 if ( err ) return done ( err ) ;
18931912
0 commit comments