spec test refactoring