ClickAider

Named references in Rails test fixtures

Court3nay has created support for named references in test fixtures in Rails:

I’ve written some fun code to ease the pain of associating between
fixtures.  ’Tis tested and documented!  Essentially it allows you to
replace this syntax

  user_id: 5

with this:

  user: :joe

as long as you have users.yml with

joe:

This is a big time save for anyone creating Rails tests that use associations.

1 Comment so far
Leave a comment

So when are you going to check this into coffeerobot trunk?


Leave a comment

(required)

(required)