# Rake:test loses working directory in 0.8.7?

**URL:** <https://www.ruby-forum.com/t/rake-test-loses-working-directory-in-0-8-7/189213>\
**Category:** Rails\
**Created:** [May 26, 2010, 9:44pm UTC](https://www.ruby-forum.com/t/rake-test-loses-working-directory-in-0-8-7/189213 "2010-05-26T21:44:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [May 26, 2010, 9:44pm UTC](https://www.ruby-forum.com/t/rake-test-loses-working-directory-in-0-8-7/189213/1 "2010-05-26T21:44:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [May 26, 2010, 10:35pm UTC](https://www.ruby-forum.com/t/rake-test-loses-working-directory-in-0-8-7/189213/2 "2010-05-26T22:35:52Z")

</div>

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
