# Odd problem with rake test

**URL:** <https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351>\
**Category:** Rails\
**Created:** [December 10, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351 "2008-12-10T22:23:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [December 10, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351/1 "2008-12-10T22:23:09Z")

</div>

I’ve got a strange problem with raking my tests. They come up all clear  
when I do rake:functionals but when I run them as individual ruby files  
the test fail as they should. What’s the difference? Does anyone else  
have problems like this.

John S.

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [December 11, 2008, 5:39pm UTC](https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351/2 "2008-12-11T17:39:20Z")

</div>

On Dec 10, 2008, at 4:23 PM, John S. wrote:

> I’ve got a strange problem with raking my tests. They come up all  
> clear  
> when I do rake:functionals but when I run them as individual ruby  
> files  
> the test fail as they should. What’s the difference? Does anyone else  
> have problems like this.
> 
> John S.

My guess is that you are using fixtures and each test that fails isn’t  
specifying the ones on which it relies.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid  
+1 513-295-4739  
Skype: rob.biedenharn

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [December 12, 2008, 8:27am UTC](https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351/3 "2008-12-12T08:27:44Z")

</div>

> My guess is that you are using fixtures and each test that fails isn’t  
> specifying the ones on which it relies.
> 
> -Rob  
> Rob

Err, no. The test unit specifies the fixtures it uses so that should be  
OK. But the error comes from a missing variable in a partial. It fails  
when I run ruby test/functional/etc but not when I rake  
test:functionals.

It’s worrying because I have to wonder what other tests should be  
failing but aren’t failing when I run the entire test suite rather than  
the individual units.

John

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [December 12, 2008, 9:17am UTC](https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351/4 "2008-12-12T09:17:39Z")

</div>

> IIRC there is an issue where partials sort of remember :locals that  
> were passed in previous invocations (in that they will exist with  
> value nil on subsequent calls if you don’t specify them)
> 
> Fred

That sounds like it’s the exact problem. Thanks for that, I’ll know to  
make sure to run the test units directly next time I change any local  
variables in partials.

Ta

John S.

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [December 12, 2008, 8:53am UTC](https://www.ruby-forum.com/t/odd-problem-with-rake-test/155351/5 "2008-12-12T08:53:56Z")

</div>

On 12 Dec 2008, at 07:27, John S. wrote:

> Err, no. The test unit specifies the fixtures it uses so that should  
> be  
> OK. But the error comes from a missing variable in a partial. It fails  
> when I run ruby test/functional/etc but not when I rake  
> test:functionals.
> 
> It’s worrying because I have to wonder what other tests should be  
> failing but aren’t failing when I run the entire test suite rather  
> than  
> the individual units.

IIRC there is an issue where partials sort of remember :locals that  
were passed in previous invocations (in that they will exist with  
value nil on subsequent calls if you don’t specify them)

Fred
