File.writable? doesn't report correctly if a directory is writable on Windows.
I've tried installing a gem per user using a 64 Bit version of Ruby for Windows and recognized that this failed because of permission errors. Ruby wanted to write the successfully downloaded gem to a system wide cache dir and failed because of missing permissions in that directly by default. I've reported the problem to rubygems and during investigation of the problem we recognized that File.writable? doesn't provide the correct information about if the target dir is writable or not under Windows. File.writable? ultimately checks using eaccess and access and Microsoft says the following about the latter:
When used with directories, _access determines only whether the specified directory exists; in Windows 2000 and later operating systems, all directories have read and write access.
Because of the false return value, the downloaded gem is tried to be copied to the system wide cache dir and that fails. With win32-file there's a gem available which implements the correct check, because if that is required per user installation of a gem succeeds without even trying to copy anything system wide. The full story is on GitHub: