blog.robotex.de

Rails: Using factories from engines

If you have engines, that - for your testing convenience - include factories, you may want to use them:

# spec/support/factory_girl_rails.rb:
require 'factory_girl_rails'

FactoryGirl.definition_file_paths << MultiClient::Engine.root.join(*%w(spec factories))
FactoryGirl.factories.clear
FactoryGirl.find_definitions

RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods
end

Back