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

@ -9,14 +9,4 @@
# Offense count: 3
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
Style/PredicateName:
Exclude:
- 'lib/active_model/serializer/associations.rb'
- 'test/action_controller/json_api/linked_test.rb'

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