@@ -37,6 +37,7 @@ module ForestLiana
37
37
{ name : :cutter , klass : User } ,
38
38
{ name : :island , klass : Island } ,
39
39
{ name : :eponymous_island , klass : Island } ,
40
+ { name : :location , klass : Location } ,
40
41
]
41
42
end
42
43
@@ -52,13 +53,17 @@ module ForestLiana
52
53
53
54
describe 'get_one_association_names_symbol' do
54
55
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
+ )
56
59
end
57
60
end
58
61
59
62
describe 'get_one_association_names_string' do
60
63
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
+ )
62
67
end
63
68
end
64
69
@@ -71,12 +76,12 @@ module ForestLiana
71
76
end
72
77
end
73
78
74
- context 'on a model having 2 belongsTo associations' do
79
+ context 'on a model having 3 belongsTo/hasOne associations' do
75
80
tables_associated_to_relations_name =
76
81
QueryHelper . get_tables_associated_to_relations_name ( Tree )
77
82
78
83
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 )
80
85
end
81
86
82
87
it 'should return relationships having a name different than the targeted model' do
0 commit comments