@@ -37,6 +37,7 @@ module ForestLiana
3737 { name : :cutter , klass : User } ,
3838 { name : :island , klass : Island } ,
3939 { name : :eponymous_island , klass : Island } ,
40+ { name : :location , klass : Location } ,
4041 ]
4142 end
4243
@@ -52,13 +53,17 @@ module ForestLiana
5253
5354 describe 'get_one_association_names_symbol' do
5455 it 'should return the one-one associations names as symbols' do
55- expect ( QueryHelper . get_one_association_names_symbol ( Tree ) ) . to eq ( [ :owner , :cutter , :island , :eponymous_island ] )
56+ expect ( QueryHelper . get_one_association_names_symbol ( Tree ) ) . to eq (
57+ [ :owner , :cutter , :island , :eponymous_island , :location ]
58+ )
5659 end
5760 end
5861
5962 describe 'get_one_association_names_string' do
6063 it 'should return the one-one associations names as strings' do
61- expect ( QueryHelper . get_one_association_names_string ( Tree ) ) . to eq ( [ 'owner' , 'cutter' , 'island' , 'eponymous_island' ] )
64+ expect ( QueryHelper . get_one_association_names_string ( Tree ) ) . to eq (
65+ [ 'owner' , 'cutter' , 'island' , 'eponymous_island' , 'location' ]
66+ )
6267 end
6368 end
6469
@@ -71,12 +76,12 @@ module ForestLiana
7176 end
7277 end
7378
74- context 'on a model having 2 belongsTo associations' do
79+ context 'on a model having 3 belongsTo/hasOne associations' do
7580 tables_associated_to_relations_name =
7681 QueryHelper . get_tables_associated_to_relations_name ( Tree )
7782
7883 it 'should return the one-one associations' do
79- expect ( tables_associated_to_relations_name . keys . length ) . to eq ( 2 )
84+ expect ( tables_associated_to_relations_name . keys . length ) . to eq ( 3 )
8085 end
8186
8287 it 'should return relationships having a name different than the targeted model' do
0 commit comments