Add to_json to represent method call

This commit is contained in:
charlieablett 2019-06-07 13:56:40 +12:00
parent 27dd0b8e36
commit 714018145c
3 changed files with 3 additions and 3 deletions

View file

@ -69,7 +69,7 @@ module BoardsResponses
end
def serialize_as_json(resource)
serializer.represent(resource)
serializer.represent(resource).to_json
end
def respond_with(resource)

View file

@ -15,9 +15,9 @@ describe BoardsResponses do
let!(:board) { create(:board) }
it 'serializes properly' do
expected = { id: board.id }
expected = { "id" => board.id }
expect(subject.serialize_as_json(board).to_h).to include(expected)
expect(JSON.parse(subject.serialize_as_json(board))).to include(expected)
end
end
end