Skip to content
Browse files

Make README more compatible with RDoc

  • Loading branch information...
1 parent c148122 commit 4144e2af04567b96566941f6e0b7ea59cf4aca09 @jeremyevans committed Dec 6, 2007
Showing with 22 additions and 31 deletions.
  1. +22 −31 README
@@ -1,6 +1,3 @@
fixture_dependencies is a plugin that changes the way Rails uses fixtures in
the following ways:
@@ -21,8 +18,12 @@ test/test_helper.rb after "require 'test_help'":
This overrides the default test helper to load the fixtures inside transactions
and to use FixtureDependencies to load the fixtures.
-Changes to Fixtures
+fixture_dependencies is available via http and svn:
+ svn: svn://
+ file:
+Changes to Fixtures:
fixture_dependencies is designed to require the least possible changes to
fixtures. For example, see the following changes:
@@ -42,8 +43,7 @@ nx7010, and a vendors fixture with the name lxg_computers.
Fixture files still use the table_name of the model.
-Changes to the fixtures Class Method
+Changes to the fixtures Class Method:
fixture_dependencies can still use the fixtures class method in your test:
@@ -60,8 +60,7 @@ fixtures. That doesn't work with fixture dependencies, as there is no
associated model. Instead, you use a has_and_belongs_to_many association name
in the the appropriate model fixtures (see below).
-Loading Individual Fixtures with fixtures
+Loading Individual Fixtures with fixtures class method:
There is support for loading individual fixtures (and just their dependencies),
using the following syntax:
@@ -73,8 +72,7 @@ using the following syntax:
This would load just the jeremy fixture and its dependencies. I find this is
much better than loading all fixtures in most of my test suites.
-Loading Fixtures Inside Test Methods
+Loading Fixtures Inside Test Methods:
I find that it is often better to skip the use of the fixtures method entirely,
and load the fixtures I want manually in each test method. This provides for
@@ -98,18 +96,17 @@ the loosest coupling possible. Here's an example:
Don't worry about loading the same fixture twice, if a fixture is already
loaded, it won't attempt to load it again.
-has_* Assocations in Fixtures
+has_* Assocations in Fixtures:
Here's an example of using has_one (logon_information), has_many (assets), and
has_and_belongs_to_many (groups) associations.
- id: 2
- name: Jeremy Evans
- logon_information: jeremy
- assets: [asset1, asset2, asset3]
- groups: [group1]
+ jeremy:
+ id: 2
+ name: Jeremy Evans
+ logon_information: jeremy
+ assets: [asset1, asset2, asset3]
+ groups: [group1]
logon_information is a has_one association to another table which was split
from the employees table due to database security requirements. Assets is a
@@ -124,8 +121,7 @@ groups in the order specified (and their dependencies...). Note that there
is only a load order inside a specific association, associations are stored
in the same hash as attributes and are loaded in an arbitrary order.
-Cyclic Dependencies
+Cyclic Dependencies:
fixture_dependencies handles almost all cyclic dependencies. It handles all
has_many, has_one, and habtm cyclic dependencies. It handles all
@@ -150,8 +146,7 @@ division belongs_to head_of_division when the employee is a member of the
division and also the head of the division), even that approach is not
-Known Issues
+Known Issues:
Currently, the plugin only supports yaml fixtures, but other types of fixtures
would be fairly easy to add (send me a patch if you add support for another
@@ -167,8 +162,7 @@ was rolled back in r2730 due to speed issues. See ticket #2404 on Rails' trac.
Instantiated fixtures are not available with this plugin. Instead, you should
use load(:model__fixture_name).
If you run into problems with loading your fixtures, it can be difficult to see
where the problems are. To aid in debugging an error, add the following to
@@ -179,8 +173,7 @@ test/test_helper.rb:
This will give a verbose description of the loading and saving of fixtures for
every test, including the recursive loading of all dependencies.
-Similar Ideas
+Similar Ideas:
fixture_references is a similar plugin. It uses erb inside yaml, and uses the
foreign key numbers inside of the association names, which leads me to believe
@@ -190,13 +183,11 @@ Ticket #6424 on the Rails' trac also implements a similar idea, but it parses
the associations and changes them to foreign keys, which leads me to believe it
doesn't support has_* associations either.
fixture_dependencies is released under the MIT License. See the LICENSE file
for details.
Jeremy Evans <>

0 comments on commit 4144e2a

Please sign in to comment.
Something went wrong with that request. Please try again.