some refactoring in spec