resolving Spec Error while Code is running according to requirement