spy instead of factory in tests