--
Individuals over processes. Interactions over tools. Agile Rails training from thoughtbot, the makers of Clearance, Shoulda, & Factory Girl:
http://thoughtbot.com/services/training
You received this message because you are subscribed to the "factory_girl" mailing list.
To post to this group, send email to factor...@googlegroups.com
To unsubscribe from this group, send email to
factory_girl...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/factory_girl?hl=en
1) Keep "cache_classes = true"
2) Don't have bundler require factory_girl_rails for you: "gem 'factory_girl_rails', :require => false"
3) put this at the top of spec_helper.rb and env.rb:
require 'factory_girl_rails'
Spork.trap_class_method(::Factory, :find_definitions)
However I ran into an issue where FactoryGirl loads constants in a slightly different way than Rails. If you have a class named "Foo::Bar" and get odd constant undefined errors with for Bar (not Foo::Bar), change your factories from a stringified version of the class to the literal class:
Factory.define :foo_bar, :class => "Foo::Bar" {|f| .... } # FactoryGirl chokes on me with this
Factory.define :foo_bar, :class => Foo::Bar {|f| .... } # This doesn't use FactoryGirl's constant loading.
I put together a patch to fix these constant loading issues, but I can't isolate the red/green scenario. http://groups.google.com/group/factory_girl/browse_thread/thread/8da599f731e475d7 https://github.com/zmoazeni/factory_girl/commit/457c667ca285a53960fc60ab97c8a2c364764673
--
Zach