Abu Huraira reported God's messenger as saying, "Do good deeds before trials come like portions of a dark night when a man will be a believer in the morning and an infidel in the evening, and a believer in the evening and an infidel in the morning, selling his religion for some worldly goods"
Muslim transmitted it.