wrote test and function for each_with_object