In my test cases, I want to loop through a collection of objects (different objects, depending on the scenerio), and if the objects in the collection contain the property location_id I want to verify the id has a value of e.g. 10
All the objects in the collection will be of the same type, but not all collections will have the same type i.e. some may be a collection of users, or a collection or articles etc.
I need this for my rspec tests.
Assuming that by “contain a property” means “responds to a getter method”:
If instead you are talking about collections of hashes and you want to lookup the hash key: