Rake:test loses working directory in 0.8.7?

Hi all,

I’m having a problem running tests with rake 0.8.7 on Windows. My
‘rake:test’ can’t find the test files, e.g. ‘/test/unit/xxx_test.rb’. I
traced the problem to Rake::TestTask, where it forks a new ruby process
to run the rake_test_loader.rb script. The ‘current directory’, from
which I ran ‘rake:test’, is lost. The new ruby process thinks it’s
running in my user home directory. For rake 0.7.3, this does not occur,
and the tests run find. However, I can’t see any code change that would
explain this difference?

Does anyone know of a workaround, or why this happens? Rolling back to
rake 0.7.3 works, but is clunky since our version of Rails (1.2.5) will
install the Rake 0.8.7 by default.

Thanks,

Brian

I figured it out. In 0.7.3, Rake forked the process to run the ruby
binary, e.g. “c:\ruby\bin\ruby.exe …”, whereas in 0.8.7 it uses the
windows ‘call’ command, e.g. “call c:\ruby\bin\ruby.exe …”.

Not backward compatible at all.

Brian H. wrote:

Hi all,

I’m having a problem running tests with rake 0.8.7 on Windows. My
‘rake:test’ can’t find the test files, e.g. ‘/test/unit/xxx_test.rb’. I
traced the problem to Rake::TestTask, where it forks a new ruby process
to run the rake_test_loader.rb script. The ‘current directory’, from
which I ran ‘rake:test’, is lost. The new ruby process thinks it’s
running in my user home directory. For rake 0.7.3, this does not occur,
and the tests run find. However, I can’t see any code change that would
explain this difference?

Does anyone know of a workaround, or why this happens? Rolling back to
rake 0.7.3 works, but is clunky since our version of Rails (1.2.5) will
install the Rake 0.8.7 by default.

Thanks,

Brian