Forum: Ruby on Rails Intergration testing with ordered fixtures

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Zack C. (Guest)
on 2006-04-27 07:04
(Received via mailing list)
Hi all.

I have a question on accessing fixtures by name.

I'm doing integration testing very similar to what is described in
Jamis's excellent writeup at

The problem is that I am using ordered yml fixtures so that rake loads
each element in the correct sequence. I need to do this because my
'has_many' fixtures (ex. templates) need to know the right user_id to
attach to.

# --- [ users.yml snippet ] ---
--- !omap
- zack:
   username: zackchandler

# --- [ templates.yml snippet ] ---
--- !omap
- template1:
   user_id: 1
   name: test

All fixtures load into the db in the correct order and everything
works great except...

The problem is that now I can't reference

users(:zack) which should be prepopulated by loading the fixtures in
my test cases.

Has anyone else run into this?  Any ideas?

This topic is locked and can not be replied to.