#NEWLINE# def _get_relation_associate( self , parent ) : #NEWLINE# #INDENT# flexmock ( Builder ) #NEWLINE# query = flexmock ( QueryBuilder ( None , QueryGrammar ( ) , None ) ) #NEWLINE# builder = Builder ( query ) #NEWLINE# builder . should_receive ( 'where' ) . with_args ( 'relation.id' , '=' , 'foreign.value' ) #NEWLINE# related = flexmock ( Model ( ) ) #NEWLINE# related . should_receive ( 'get_key' ) . and_return ( 1 ) #NEWLINE# related . should_receive ( 'get_table' ) . and_return ( 'relation' ) #NEWLINE# builder . should_receive ( 'get_model' ) . and_return ( related ) #NEWLINE# return MorphTo ( builder , parent , 'foreign_key' , 'id' , 'morph_type' , 'relation' )