Unit Testing behavior

Hi,

I’m relatively new to Ruby and Rails. We are using it at work and
running in a TDD/continuous integration environment.

I am getting some functional tests failing.

We have a UserController and have the basic REST endpoints for the
controller.

The functional test makes use of a user fixture to test the delete,
update and edit calls.

the edit and update test methods fail. And it is because they are
using the same fixture that the delete is. Since the delete test
method gets run first it’s deleting the user the edit and update are
depending on. (if i use a different fixture for each test they all
pass)
However it’s my understanding that the tests are supposed to be
isolated from each other and the test should pass using the same
fixture for each.

This belief is further backed up by the fact that it the tests pass on
our CI machine.

So my first guess is that it must be something on my machine (I’m
running on a Mac OS X mac book pro). But I’m not sure where to start
looking …
I’ve resynched to the source tree from my source control. So I know I
have the exact code that the source repository has.

so I’m wondering if anyone has any suggestions as to where to start
tracking this down? What types of things you would try… etc

Thanks so much!
Jay

On 29 Feb 2008, at 17:13, Jay wrote:

This belief is further backed up by the fact that it the tests pass on
our CI machine.

So my first guess is that it must be something on my machine (I’m
running on a Mac OS X mac book pro). But I’m not sure where to start
looking …
I’ve resynched to the source tree from my source control. So I know I
have the exact code that the source repository has.

Tests are run inside a transaction, so anything that breaks
transactions will break your tests (since changes won’t be rolled back).
Could it be that (assuming you’re using mysql) that your CI machine is
defaulting to InnoDB tables and your laptop is defaulting to MyISAM
(or doesn’t have innodb compiled in) ?

Fred

Jay:

How are you running the tests on your Mac? Manually? Or are you using
the
rake task to do it?

Brian,

I get the same results running both manually and via rake.

Fred,

Good point. I’ll went and double checked and you were spot on.
Apparently my mysql db was not setting the default table type to
innodb when I started it. I rectified that and all is good!

Thanks so much!
Jay