Add Dir::Tmpname implementation from MRI 2.1

The standard library (most notably Tempfile) depend on this
being present in order to function correctly. If it's not there,
Tempfile.create will fail.

It's possible that the entire implementation doesn't have to be
copied wholesale here, but in the meantime, this seems to work.
Silence a Ruby 2.1+ deprecation warning in tests.

Object#respond_to? should take an optional second argument,
or else Marshal complains when attempting to dump/load the object.

I checked, and the second argument has been around since at least
1.8.7, so it doesn't look like this is going to cause problems
in older apps.
Force encoding for binary string literal in the tests.

Ruby < 2.0 interprets string literals as ASCII-8BIT by default, but
>= 2.0 assumes all string literals (and source files) are in UTF-8.
Calling force_encoding ensures this string is interpreted as binary.
Merge remote-tracking branch 'onehub/tempfile-2-1'

* onehub/tempfile-2-1:
  Force encoding for binary string literal in the tests.
  Silence a Ruby 2.1+ deprecation warning in tests.
  Add Dir::Tmpname implementation from MRI 2.1