jsonapi-rb / jsonapi-rspec

RSpec matchers for JSON:API spec
https://rubygems.org/gems/jsonapi-rspec
MIT License
123 stars 24 forks source link

Check has_attribute instead of actual #28

Closed alexbeeken closed 3 years ago

alexbeeken commented 3 years ago

check if attribute key exists instead of checking if attribute value exists, addresses case of attribute value being nil

What is the current behavior?

If the key is present in the attributes hash but the value of it is nil it will show a test failure message of this:

Screenshot from 2020-12-18 07-29-55

which is clearly incorrect as the key is present in the array

What is the new behavior?

It will now show the correct error message of a nil value when expecting a different value

Screenshot from 2020-12-18 07-30-11

more helpful error message

Checklist

Please make sure the following requirements are complete:

stas commented 3 years ago

Thank you @alexbeeken