re: RuboCop - use include_ prefix instead of has_

This commit is contained in:
Alexey Dubovskoy
2016-06-20 22:01:44 +01:00
parent aa416b2fb3
commit ce168f9414
2 changed files with 3 additions and 13 deletions

View File

@@ -183,17 +183,17 @@ module ActionController
get '/render_resource_with_missing_nested_has_many_include'
response = JSON.parse(@response.body)
assert response.key? 'included'
refute has_type?(response['included'], 'roles')
refute include_type?(response['included'], 'roles')
end
def test_render_collection_with_missing_nested_has_many_include
get '/render_collection_with_missing_nested_has_many_include'
response = JSON.parse(@response.body)
assert response.key? 'included'
assert has_type?(response['included'], 'roles')
assert include_type?(response['included'], 'roles')
end
def has_type?(collection, value)
def include_type?(collection, value)
collection.detect { |i| i['type'] == value }
end
end