Intergration testing with ordered fixtures


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?