Add unit tests for Trigram conditions

This also includes a major overhaul of this whole spec file, collapsing
much setup into some `let`s and using an OpenStruct for the config
object.