Remove `any_number_of_times` from mock expectations in IO specs

This was causing a false positive whereby the example specifying that
the :encoding option is coerced into a String was passing even when the
to_str method was never called on the mock object.
Coerce the :encoding option to a String when it's not an Encoding object