Open
Description
Hi! I'm trying to use my entity to ensure the returned data in the API matches what my Entity should be exposing in a RSpec request spec in my rails application.
I'm doing this:
it 'returns the change events for the incident as json' do
authed_get "/v1/incidents/#{incident.id}/related_change_events"
expect(parsed['data']).to match_array(PublicAPI::V1::Incidents::RelatedChangeEventEntity.represent(related_change_events).as_json.as_json)
end
This makes my test pass, but why do I have to call #as_json
twice? This feels weird to me and I don't see a method on the Grape::Entity
class that gives me what I want. More of a question than a bug but I see room for improvement here.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels