Add additional test to the contain nested functionality and refactor to use shared examples