@@ -11,7 +11,7 @@ class JoinManagerTest < ActiveSupport::TestCase
1111 # end
1212
1313 def test_no_added_joins
14- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource )
14+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource )
1515
1616 records = PostResource . records ( { } )
1717 records = join_manager . join ( records , { } )
@@ -22,7 +22,7 @@ def test_no_added_joins
2222
2323 def test_add_single_join
2424 filters = { 'tags' => [ '1' ] }
25- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource , filters : filters )
25+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource , filters : filters )
2626 records = PostResource . records ( { } )
2727 records = join_manager . join ( records , { } )
2828 assert_equal 'SELECT "posts".* FROM "posts" LEFT OUTER JOIN "posts_tags" ON "posts_tags"."post_id" = "posts"."id" LEFT OUTER JOIN "tags" ON "tags"."id" = "posts_tags"."tag_id"' , sql_for_compare ( records . to_sql )
@@ -32,7 +32,7 @@ def test_add_single_join
3232
3333 def test_add_single_sort_join
3434 sort_criteria = [ { field : 'tags.name' , direction : :desc } ]
35- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource , sort_criteria : sort_criteria )
35+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource , sort_criteria : sort_criteria )
3636 records = PostResource . records ( { } )
3737 records = join_manager . join ( records , { } )
3838
@@ -44,7 +44,7 @@ def test_add_single_sort_join
4444 def test_add_single_sort_and_filter_join
4545 filters = { 'tags' => [ '1' ] }
4646 sort_criteria = [ { field : 'tags.name' , direction : :desc } ]
47- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource , sort_criteria : sort_criteria , filters : filters )
47+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource , sort_criteria : sort_criteria , filters : filters )
4848 records = PostResource . records ( { } )
4949 records = join_manager . join ( records , { } )
5050 assert_equal 'SELECT "posts".* FROM "posts" LEFT OUTER JOIN "posts_tags" ON "posts_tags"."post_id" = "posts"."id" LEFT OUTER JOIN "tags" ON "tags"."id" = "posts_tags"."tag_id"' , sql_for_compare ( records . to_sql )
@@ -58,7 +58,7 @@ def test_add_sibling_joins
5858 'author' => [ '1' ]
5959 }
6060
61- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource , filters : filters )
61+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource , filters : filters )
6262 records = PostResource . records ( { } )
6363 records = join_manager . join ( records , { } )
6464
@@ -70,7 +70,7 @@ def test_add_sibling_joins
7070
7171
7272 def test_add_joins_source_relationship
73- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource ,
73+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource ,
7474 source_relationship : PostResource . _relationship ( :comments ) )
7575 records = PostResource . records ( { } )
7676 records = join_manager . join ( records , { } )
@@ -81,7 +81,7 @@ def test_add_joins_source_relationship
8181
8282
8383 def test_add_joins_source_relationship_with_custom_apply
84- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : Api ::V10 ::PostResource ,
84+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : Api ::V10 ::PostResource ,
8585 source_relationship : Api ::V10 ::PostResource . _relationship ( :comments ) )
8686 records = Api ::V10 ::PostResource . records ( { } )
8787 records = join_manager . join ( records , { } )
@@ -100,7 +100,7 @@ def test_add_nested_scoped_joins
100100 'author' => [ '1' ]
101101 }
102102
103- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : Api ::V10 ::PostResource , filters : filters )
103+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : Api ::V10 ::PostResource , filters : filters )
104104 records = Api ::V10 ::PostResource . records ( { } )
105105 records = join_manager . join ( records , { } )
106106
@@ -117,7 +117,7 @@ def test_add_nested_scoped_joins
117117 'comments.tags' => [ '1' ]
118118 }
119119
120- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : Api ::V10 ::PostResource , filters : filters )
120+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : Api ::V10 ::PostResource , filters : filters )
121121 records = Api ::V10 ::PostResource . records ( { } )
122122 records = join_manager . join ( records , { } )
123123
@@ -135,7 +135,7 @@ def test_add_nested_joins_with_fields
135135 'author.foo' => [ '1' ]
136136 }
137137
138- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : Api ::V10 ::PostResource , filters : filters )
138+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : Api ::V10 ::PostResource , filters : filters )
139139 records = Api ::V10 ::PostResource . records ( { } )
140140 records = join_manager . join ( records , { } )
141141
@@ -149,14 +149,14 @@ def test_add_nested_joins_with_fields
149149 def test_add_joins_with_sub_relationship
150150 relationships = %w( author author.comments tags )
151151
152- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : Api ::V10 ::PostResource , relationships : relationships ,
152+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : Api ::V10 ::PostResource , relationships : relationships ,
153153 source_relationship : Api ::V10 ::PostResource . _relationship ( :comments ) )
154154 records = Api ::V10 ::PostResource . records ( { } )
155155 records = join_manager . join ( records , { } )
156156
157157 assert_hash_equals ( { alias : 'comments' , join_type : :inner } , join_manager . source_join_details )
158158 assert_hash_equals ( { alias : 'comments' , join_type : :inner } , join_manager . join_details_by_relationship ( Api ::V10 ::PostResource . _relationship ( :comments ) ) )
159- assert_hash_equals ( { alias : 'tags' , join_type : :left } , join_manager . join_details_by_relationship ( Api ::V10 ::CommentResource . _relationship ( :tags ) ) )
159+ assert_hash_equals ( { alias : 'tags' , join_type : :left } , join_manager . join_details_by_relationship ( Api ::V10 ::PostResource . _relationship ( :tags ) ) )
160160 assert_hash_equals ( { alias : 'comments_people' , join_type : :left } , join_manager . join_details_by_relationship ( Api ::V10 ::PersonResource . _relationship ( :comments ) ) )
161161 end
162162
@@ -168,7 +168,7 @@ def test_add_joins_with_sub_relationship_and_filters
168168
169169 relationships = %w( author author.comments tags )
170170
171- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PostResource ,
171+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PostResource ,
172172 filters : filters ,
173173 relationships : relationships ,
174174 source_relationship : PostResource . _relationship ( :comments ) )
@@ -177,13 +177,13 @@ def test_add_joins_with_sub_relationship_and_filters
177177
178178 assert_hash_equals ( { alias : 'comments' , join_type : :inner } , join_manager . source_join_details )
179179 assert_hash_equals ( { alias : 'comments' , join_type : :inner } , join_manager . join_details_by_relationship ( PostResource . _relationship ( :comments ) ) )
180- assert_hash_equals ( { alias : 'people' , join_type : :left } , join_manager . join_details_by_relationship ( CommentResource . _relationship ( :author ) ) )
181- assert_hash_equals ( { alias : 'tags' , join_type : :left } , join_manager . join_details_by_relationship ( CommentResource . _relationship ( :tags ) ) )
180+ assert_hash_equals ( { alias : 'people' , join_type : :left } , join_manager . join_details_by_relationship ( PostResource . _relationship ( :author ) ) )
181+ assert_hash_equals ( { alias : 'tags' , join_type : :left } , join_manager . join_details_by_relationship ( PostResource . _relationship ( :tags ) ) )
182182 assert_hash_equals ( { alias : 'comments_people' , join_type : :left } , join_manager . join_details_by_relationship ( PersonResource . _relationship ( :comments ) ) )
183183 end
184184
185185 def test_polymorphic_join_belongs_to_just_source
186- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new (
186+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new (
187187 resource_klass : PictureResource ,
188188 source_relationship : PictureResource . _relationship ( :imageable )
189189 )
@@ -200,7 +200,7 @@ def test_polymorphic_join_belongs_to_just_source
200200
201201 def test_polymorphic_join_belongs_to_filter
202202 filters = { 'imageable' => [ 'Foo' ] }
203- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PictureResource , filters : filters )
203+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PictureResource , filters : filters )
204204
205205 records = PictureResource . records ( { } )
206206 records = join_manager . join ( records , { } )
@@ -217,7 +217,7 @@ def test_polymorphic_join_belongs_to_filter_on_resource
217217 }
218218
219219 relationships = %w( imageable file_properties )
220- join_manager = JSONAPI ::ActiveRelation ::JoinManagerV10 . new ( resource_klass : PictureResource ,
220+ join_manager = JSONAPI ::ActiveRelation ::JoinManager . new ( resource_klass : PictureResource ,
221221 filters : filters ,
222222 relationships : relationships )
223223
0 commit comments