added toThrow and refactored specs