This resolves an issue where factory_girl_rails won't get required if
you only have factory_girl_rails declared in the :test group of a Rails
app.
Closes#89
The factory name for the model Namespaced::User wil be :namespaced_user.
The :class option is specified as a string to prevent class reloading issues.
Addresses GH-44
When a (mountable) engine defines models and factories to test the models, sometimes it is convenient to use this factories
from a project which depends on the engine.
But current factory_girl_rail initialization processes do not allow to do so without hacks.
(after_initializer resets all FactoryGirl.definition_file_paths to defaults with = [paths])
When this change introduces the engine can advertise some factories in an its own railtie, i.e.:
module ModelCore
class Engine < Rails::Engine
initializer "model_core.factories", :after => "factory_girl.set_factory_paths" do
FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
end
end
end