Fix test failure on windows

It needs switching windows or othres because lib/rubygems/test_case.rb:283
switches the platform string.

Import of r41889 by naruse from ruby trunk
Fix shebang test failure introduced at r41873

On Windows, it doesn't use /usr/bin/env.

Import of r41891 by naruse from ruby trunk
Fix PATH environ related test failure

On Windows PATH_SEPARATOR is ';'.  Therefore it can't be hardcoded.

Import of r41892 by naruse from ruby trunk
Fix warnings
to_ary must return an Array on 1.8

The goal of the change was to avoid calls to method_missing, but
defining to_ary was not the correct choice.  This fails on 1.8, where it
must return an Array.  This makes a Gem::Specification appear as if it
were an Array which it is not.

Instead respond_to_missing? is defined which returns false.  I did not
test if this is more or less efficient than defining to_ary.

This reverts @54cf153b from #477
Fix warning about unsupported encoding in 1.8.7
Untaint spec_cache_dir for $SAFE=1
On ruby 1.8.7 a Tempfile can be unlinked only once
Move bug fix to 2.0.5 in History.txt
merge ruby/ruby@5de05f5