Refactor spec helpers