Bring fixture references plugin into core?

Various proposals have been floating around to allow users to specify references to other fixtures in their fixture files, so that foreign key references are kept consistent in test fixtures.

One of the suggestions was to bring the fixture references plugin ( into core. I know that, as a plugin, it's not hard to include it in your Rails application, but it's a rare Rails app indeed that doesn't have some measure of foreign key in it, and keeping fixtures as flexible and un-brittle as possible seems like a big win for testing.

What do other people think about bringing this plugin in? If it's considered a possibility, I'll open up a ticket with a patch and whatnot, I just don't want to add yet more noise to Trac if it's generally considered a bad idea.

- Matt

Yeah it seems like a better syntax, though I haven't actually looked
at their code so I can't vouch for its core-iness. Feel free to kill
my patch[1] and reopen one regarding fixture references.

[1] I'm happy that people are inspired to write better versions of my
half-baked plugins :smiley:

I'm myself a bit undecided on whether this is something that should be in core. On the one hand, I find it really helps in quickly looking over a fixture and seeing what else it references. It also helps me to forget about ids and focus on relationships. On the other hand, I don't know how many people actually care about the brittleness of their fixtures.

I'd be more than happy to assist in making any suggested changes to the plugin/documentation if others feel this is worth submitting a patch for.


Maybe there's a need for a super-fixtures plugin combining the features of all the disparate fixture plugins.

First, can you combine fixture references with this patch?

It allows code like

  fixture :topics_set_two, :table_name => "topics", :file_name => "topics2"

Are there any more useful edge-case fixtures patches?

Hmm, my initial feeling is that they should be separate since they tackle separate problems, even though they're both related to fixtures. I'm guessing core would rather see small, incremental updates rather than 1 mega-patch...?