Sahih al-Bukhari
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
حَدَّثَنِي إِبْرَاهِيمُ بْنُ الْحَارِثِ، حَدَّثَنَا يَحْيَى بْنُ أَبِي بُكَيْرٍ، حَدَّثَنَا إِسْرَائِيلُ، عَنْ أَبِي حَصِينٍ، عَنْ سَعِيدِ بْنِ جُبَيْرٍ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ قَالَ {وَمِنَ النَّاسِ مَنْ يَعْبُدُ اللَّهَ عَلَى حَرْفٍ} قَالَ كَانَ الرَّجُلُ يَقْدَمُ الْمَدِينَةَ، فَإِنْ وَلَدَتِ امْرَأَتُهُ غُلاَمًا، وَنُتِجَتْ خَيْلُهُ قَالَ هَذَا دِينٌ صَالِحٌ. وَإِنْ لَمْ تَلِدِ امْرَأَتُهُ وَلَمْ تُنْتَجْ خَيْلُهُ قَالَ هَذَا دِينُ سُوءٍ.
Narrated Ibn `Abbas:
Regarding the Verse: "And among men is he who worships Allah's as it were on the very edge." (22:11). A man used to come to Medina as if his wife brought a son and his mares produces offspring. He would say, "This religion (Islam) is good," but if his wife did not give birth to a child and his mares produced no offspring, he would say, "This religion is bad."
Full reference and source
Sahih al-Bukhari USC-MSA web (English) : Vol. 6, Book 60, Hadith 266 Arabic : Book 65, Hadith 4742
View source on Sunnah.com (opens in a new tab)