Refactor spec helper