The pull-off-a-leaf test has never failed me. Moreover: look at the pineapple up close and smell it. Seeing some yellow is good, a lot of brown is not good. The smell should be strongly sugary, pleasant and with a touch of alcohol. Avoid if the alcohol smell is very strong or, worse, if there is a note of vinegar. Pineapples are high in sugar and they can start fermenting.