When it comes to mating, fruit flies can make rational choices

Humans make rational choices—though perhaps not all the time. But does the ability for rational decision-making extend to other members of the animal kingdom? If so, how far are they from the human lineage?