According to Snopes both clinking glasses to ward off evil spirits, and to test for poison in the spirits, is false.
Many explanations have been advanced to explain our custom of clinking glasses when participating in toasts. One is that early Europeans felt the sound helped to drive off evil spirits. Another holds that by clanking the glasses into one another, wine could be sloshed from glass to glass, thereby serving as a proof the beverages had not been poisoned. Yet another claim asserts that the “clink” served as a symbolic acknowledgment of trust among imbibers who did not feel the need to sample each others’ drinks to prove them unadulterated.
Why do we clink glasses and say cheers?
Apparently the real reason has its roots in a benediction end of worship service tradition when everyone used to drink out of the same cup. To make up for the fact that everyone now drinks out of their own cup, we clink glasses to bring everyone together as if we were all drinking from the same "loving cup".
“Toasting,” our term for the pronouncement of benedictions followed by a swallowing of alcohol, is believed to have taken its name from a practice involving a shared drinking vessel. Floated in the “loving cup” passed among celebrants in Britain was a piece of (spiced) cooked bread that the host would consume along with the last few drops of liquid after the cup had made one round of the company. In modern times toasting has become a matter of imbibing from individual drinking vessels rather than from one shared flagon, so to compensate for the sense of unity lost in doing away with the sharing of the same cup we have evolved the practice of simultaneously drinking each from our own glass when a toast is made, thereby maintaining a communal connection to the kind words being spoken.