Simplify string handling in spec/main.rb.
Simplify string handling in spec/main.rb.

The code paths are nearly the same, so make them share the same code,
both to reduce duplication, and as documentation.

Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>

bk2204/daniel-ruby,bk2204/daniel-ruby