Add specs around passing invalid types to methods

After the crash in Regexp#match, ensure that other methods guard against
being passed unexpected types.