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:
Lucas Hosseini
2015-10-02 15:29:04 +02:00
3 changed files with 20 additions and 1 deletions

View File

@@ -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)