remove needs when affiliation are pending
acceptance test
To test, reset your database with bundle exec rails db:reset
then
visit the api/space/1/needs
a needs should be display.
>> Affiliation.where(parent: Space.first, affiliate_type: 'Project').where.not(status: 'pending').pluck(:affiliate_id)
>> [1]
>> Affiliation.first.pending!
>> Affiliation.where(parent: Space.first, affiliate_type: 'Project').where.not(status: 'pending').pluck(:affiliate_id)
>> [0]
http://localhost:3001/api/spaces/1/needs
should not display any needs.
Edited by LucaH