[Rails][FactoryGirl] エラー:Factory already registered: xxx

Tadashi Shigeoka ·  Wed, December 5, 2012

Ruby on Railsにて、

Factory already registered: xxx

lib/tasks/

require 'factory_girl'
Dir[Rails.root.join('spec/factories/*.rb')].each {|f| require f }

【参考】ruby on rails - Factory already registered: user (FactoryGirl::DuplicateDefinitionError) - Stack Overflow はてなブックマーク - ruby on rails - Factory already registered: user (FactoryGirl::DuplicateDefinitionError) - Stack Overflow