# Unit Testing behavior

**URL:** <https://www.ruby-forum.com/t/unit-testing-behavior/130598>\
**Category:** Rails\
**Created:** [February 29, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/unit-testing-behavior/130598 "2008-02-29T18:14:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jay](https://www.ruby-forum.com/u/jay)\
**Post date:** [February 29, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/unit-testing-behavior/130598/1 "2008-02-29T18:14:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jay](https://www.ruby-forum.com/u/jay)\
**Post date:** [February 29, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/unit-testing-behavior/130598/2 "2008-02-29T18:29:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jay](https://www.ruby-forum.com/u/jay)\
**Post date:** [February 29, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/unit-testing-behavior/130598/3 "2008-02-29T18:29:52Z")

</div>

Jay:

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

---

<div class="post-metadata">

**Author:** ![jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jay](https://www.ruby-forum.com/u/jay)\
**Post date:** [February 29, 2008, 9:31pm UTC](https://www.ruby-forum.com/t/unit-testing-behavior/130598/4 "2008-02-29T21:31:05Z")

</div>

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
