Fix gsub for tests on windows

The gsub! inadvertently altered @bin_dir while checking if the user bin
dir was in the user's path.

Now gsub is used instead to isolate the check from the instance variable
it is checking.

Fixes ruby bug #7885