I am trying to use RSpec with the gem Airborne to test the value of a field in a JSON response of 'people' objects from an API.
Code:
it 'GET list of people objects where gender = male' do
get "/people?gender=male"
expect_json('people.*', {gender: 'MALE'})
end
So if my test makes an API call with this particular filter (gender), I expect to only pull back people with gender of male. However this code fails, because every 'person' object has many different keys (:name, :age, etc.). I ONLY want to test the gender, but I am unable to get it to pass because expect_json is expecting ALL of the keys in people to be written into the test.
I have combed through Google/Airborne documentation but to no avail: https://github.com/brooklynDev/airborne
people : [{person},{person}]or an object of lots of people?people: {{person},{person}}?people : [{person},{person}]