testing and refactoring categories, entities and user spec