Improved code coverage for GraphQL resolvers specs

This commit is contained in:
Alberto Miedes Garcés
2017-01-09 10:14:31 +01:00
parent e1b3d468e5
commit 60786f17c2
3 changed files with 35 additions and 18 deletions

View File

@@ -7,11 +7,18 @@ module GraphQL
end
def call(object, arguments, context)
if target_model.respond_to?(:public_for_api)
target_model.public_for_api.find_by(id: arguments["id"])
else
target_model.find_by(id: arguments["id"])
end
public_elements.find_by(id: arguments['id'])
end
private
def public_elements
if target_model.respond_to?(:public_for_api)
target_model.public_for_api
else
target_model
end
end
end
end