refactored specs and mocks