ministryofjustice / Claim-for-Crown-Court-Defence

Claim for Crown Court Defence, formerly Advocate Defence Payments (ADP), aka Crime Billing Online (CBO)
MIT License
25 stars 7 forks source link

[RSpec] JSON matchers #2417

Open lostie opened 6 years ago

lostie commented 6 years ago

We have quite a lot of specs that require checking for the JSON output of an API.

This RSpec helpers should help us asserting more accurately the format and content of those outputs.

For example it allows us to use matchers inside the body, lets say for example if we're just interested in checking that we have a key foo with a value that is an Integer: https://relishapp.com/waterlink/rspec-json-expectations/docs/json-expectations/rspec-matcher-support-for-include-json-matcher

@colinbruce @kmahern This is not a blocker for the ping issues PR, but could improve the assertions being made in the tests to assert both keys and values

jsugarman commented 6 years ago

we do already have this in the repo: https://github.com/collectiveidea/json_spec