fixtures subdirectories

120 views
Skip to first unread message

bhus

unread,
Apr 7, 2008, 11:54:42 AM4/7/08
to Ruby on Rails: Core
I have come to a seeming realization that rails will only load
fixtures
from one directory per each functional test file (this seems a little
un-DRY to
me). Am I wrong in my assumption; can it be done? Or is this
intentional and I simply don't understand how things are supposed to
work?

I'm a Rails noob, but I am willing to dive into the Rails source if it
is just a matter of putting
some hours into it.

/Brad.

Andrew Kaspick

unread,
Apr 7, 2008, 12:10:22 PM4/7/08
to rubyonra...@googlegroups.com
If you have some namespaced models, then the associated namespaced
fixtures will be in their own directory by default.

bhus

unread,
Apr 7, 2008, 12:22:40 PM4/7/08
to Ruby on Rails: Core
Thanks for your response Andrew.

I should have been more specific in my question : my reason for
wanting this is so I can have a few different fixture files for the
SAME model : it seems I can't have fixtures for the same model in the
same directory.

[ I have a few "count" methods that I want to make sure are working
correctly in different circumstances (eg. depending on what type of
user is making the call) ]

Mislav Marohnić

unread,
Apr 7, 2008, 3:56:14 PM4/7/08
to rubyonra...@googlegroups.com
You probably want fixture scenarios.
http://errtheblog.com/posts/61-fixin-fixtures

bhus

unread,
Apr 7, 2008, 4:14:34 PM4/7/08
to Ruby on Rails: Core
Thanks for taking the time to reply, Mislav.

Just looked at scenarios. This looks promising, but there doesn't
seem
to be any way to share fixtures between multiple tests.
I have a set of lookup tables that won't change between tests,
whereas i have another table that I would like to change from test to
test.

I may not be understanding scenarios properly, though, so I will have
a closer look tomorrow.

/Brad.
Reply all
Reply to author
Forward
0 new messages