mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #1214 from NullVoxPopuli/issue/1211-failing-test
Fix #1211, include_tree is null when using the key: options
This commit is contained in:
@@ -46,6 +46,11 @@ module ActionController
|
||||
render json: @post, include: [:author], adapter: :json_api
|
||||
end
|
||||
|
||||
def render_resource_with_include_of_custom_key_by_original
|
||||
setup_post
|
||||
render json: @post, include: [:reviews], adapter: :json_api, serializer: PostWithCustomKeysSerializer
|
||||
end
|
||||
|
||||
def render_resource_with_nested_include
|
||||
setup_post
|
||||
render json: @post, include: [comments: [:author]], adapter: :json_api
|
||||
@@ -137,6 +142,18 @@ module ActionController
|
||||
assert_equal expected_linked, response['included']
|
||||
end
|
||||
|
||||
def test_render_resource_with_include_of_custom_key_by_original
|
||||
get :render_resource_with_include_of_custom_key_by_original
|
||||
response = JSON.parse(@response.body)
|
||||
assert response.key? 'included'
|
||||
|
||||
relationships = response['data']['relationships']
|
||||
|
||||
assert_includes relationships, 'reviews'
|
||||
assert_includes relationships, 'writer'
|
||||
assert_includes relationships, 'site'
|
||||
end
|
||||
|
||||
def test_render_resource_with_nested_include
|
||||
get :render_resource_with_nested_include
|
||||
response = JSON.parse(@response.body)
|
||||
|
||||
Reference in New Issue
Block a user