Closed
Description
I am trying to write a controller spec for something that already works as expected, namely:
render json: products, include: 'category', meta: pagination
which gives me the JSON API that I expect. I'm trying to write something like this in my tests:
product = FactoryGirl.create(:product)
expected_json = ActiveModel::Serializer::Adapter.create(
ActiveModel::Serializer::ArraySerializer.new(
[product],
included: 'category'
meta: pagination
)
).to_json
but I can't seem to get the included
part to display (the data
and meta
attributes work just fine). Any help to programatically create a JSON document w/ included
would be greatly appreciated.
Metadata
Metadata
Assignees
Labels
No labels