fixed mock login in rspecs, refactores into module