Moving encode option spec to shared example

because both IO.write and IO.binwrite must support this option.