Refactor spec tests