Is it necessary to put so much logic into the spec? That sounds error prone. Can't you provide a concrete string here?