.
The rich young ruler asked Jesus what he needed to do to inherit eternal life and Jesus told him to keep the commandments one of them being to love your neighbour as yourself. The rich young ruler said he did keep the commandments. So Jesus very cleverly said to the young man to sell up and give to the poor. The rich young ruler refused to do this, proving once and for all that he did not keep the commandments. It was a test and the young man failed.
All we are told to do to inherit eternal life is to believe on the Lord Jesus Christ and to confess our sins.
.