[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby on Rails Test Fixtures

bourea

12/27/2006 2:09:00 AM

When I use test fixtures to populate test data into mysql database I am
running into an unexpected behavior. Only columns explicitly defined
in the fixture is populated into the database. However, created_on,
created_by, updated_on, updated_by fields along with all fields
normally populated by observers are NULL. For example, I have a couple
fields that have their values calculated via observers. I want to test
that these calculations are performed correctly by the observer, so I
don't want to hard code their values in the fixture.

Has anyone else run into this issue? If so, how did you perform
testing of these fields? I realize that I could perform these tests
without fixtures by creating and saving the object. Behind the scenes,
Active Record populates all the fields in the expected manner. Then I
could find the saved record and assert_equal the expected calculations.
However this approach seems brittle and I rather use fixtures. It
doesn't seem (from the results) that I am getting that the fixtures
functionality uses Active Record to serialize data to mysql.

Thanks!

1 Answer

Tim Hunter

12/27/2006 2:50:00 AM

0

bourea@gmail.com wrote:
> When I use test fixtures to populate test data into mysql database I am
> running into an unexpected behavior
Probably the Ruby on Rails mailing list will have lots of folks who
would be able to help. Here's info about it:

http://www.rubyonrails.org...