[rspec-users] Failing on rake but not on textmate (rails)

Macario Ortega lists at ruby-forum.com
Thu Jul 24 15:27:02 EDT 2008


Rick Denatale wrote:
> On Mon, Jul 21, 2008 at 8:34 PM, Mark Wilden <mark.wilden at gmail.com> 
> wrote:
> 
>> don't know if that explains the behavior you're seeing.
>>
>>
>>> I would like to use autotest but I can't trust the results.
>>>
>>
>> autotest also does not copy the database structure. I've been using it for
>> six months and I've never noticed a problem with it. Why don't you trust it?
>>
>> I doubt that it's a problem with not copy the database structure from dev
> to test. That sync's the db schema and would only be needed after a 
> schema
> change (i.e. one or more migrations have been run), and it would be much
> more likely to cause a failure in Textmate when the code under test 
> doesn't
> see the expected db schema.
> 
> It's more likely that there are undeclared fixtures affecting the spec, 
> a
> spec which needs particular state in the database might succeed or not
> depending on whether or not previous specs either left data behind, or
> deleted data needed by the spec in question.
> 
> When I've seen cases where test/specs behaved differently when run
> separately vs. being run in batch (e.g. by Rake) it's almost always 
> because
> I left out a fixture declaration.
> 
> --
> Rick DeNatale
> 
> My blog on Ruby
> http://talklikeaduck.denhaven2.com/


Hi, thanks for the answer today I ran rake several times and all my test 
passed (and that made me very happy) but suddenly the tests for this 
model started failing again.

Prior to each test I delete all records for the model and I have no 
fixture for that particular model.

I am just starting with sdd and I find fixtures to give me more trouble 
than they solve so when I need to populate the database I create and 
save the models I need thus I have all the dependencies.

What do you mean by undeclared fixture? a fixture with no data?

What is strange is that some validation specs ('it should require name') 
that don't depend on database also fail.


-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list