Forum: Ruby on Rails Odd problem with rake test

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2008-12-10 22:23
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 Small
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2008-12-11 17:39
(Received via mailing list)
On Dec 10, 2008, at 4:23 PM, John Small 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 Small

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

-Rob

Rob Biedenharn    http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
Skype:  rob.biedenharn
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2008-12-12 08:27
>
> 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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-12 08:53
(Received via mailing list)
On 12 Dec 2008, at 07:27, John Small 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
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2008-12-12 09:17
> 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 Small
This topic is locked and can not be replied to.