I want to change my JSON validation to something else.
Currently I use json_spec matcher and I expect that the 2 JSON's to be exactly the same.
expect(last_body).to be_json_eql(expected_response).excluding(*excluding)
I want to match those 2 JSON's based on this 2 things: -that they have the same keys -and if I provide a set of keys, that it checks for the values also.
expect(last_body).to match(expected_response).values(%i[id name])
I've tried json-schema but it doesn't really help because I want to validate the data in some cases and I want to use actual response json's for testing, the ones I have included in my documentation.
Aucun commentaire:
Enregistrer un commentaire