refactor specs and test class method