refactored spec helper