#NEWLINE# def _get_relation( self ) : #NEWLINE# #INDENT# flexmock ( Builder ) #NEWLINE# query = flexmock ( QueryBuilder ( None , QueryGrammar ( ) , None ) ) #NEWLINE# builder = Builder ( query ) #NEWLINE# builder . should_receive ( 'where' ) . with_args ( 'table.foreign_key' , '=' , 1 ) #NEWLINE# related = flexmock ( Model ( ) ) #NEWLINE# related . should_receive ( 'new_query' ) . and_return ( builder ) #NEWLINE# builder . should_receive ( 'get_model' ) . and_return ( related ) #NEWLINE# parent = flexmock ( Model ( ) ) #NEWLINE# parent . should_receive ( 'get_attribute' ) . with_args ( 'id' ) . and_return ( 1 ) #NEWLINE# parent . should_receive ( 'get_created_at_column' ) . and_return ( 'created_at' ) #NEWLINE# parent . should_receive ( 'get_updated_at_column' ) . and_return ( 'updated_at' ) #NEWLINE# parent . should_receive ( 'new_query' ) . and_return ( builder ) #NEWLINE# return HasMany ( builder , parent , 'table.foreign_key' , 'id' )