sunaku/tork — Issue #26: Reloading FactoryGirl definitions
Author: mhayes
Created: 2012-01-27 04:40:59+00:00
State: open

When using `FactoryGirl` with `Test::Unit` I kept running into the following issue:

```bash
Factory already registered: user (FactoryGirl::DuplicateDefinitionError)
```

I found that adding `FactoryGirl.factories.clear` to `test/test_helper.rb` resolves this issue, like so:

```ruby
require "factory_girl"
at_exit do
unless $!
FactoryGirl.factories.clear
FactoryGirl.find_definitions
end
end
```

Not sure if this is specific to `Test::Unit` or not, but thought I'd mention it in case the README needs an update. Oh and btw Tork is totally the cat's pajamas!