Factory.create wrong number of arguments (0 for 3)

Using factory_girl 2.0.0 beta1

Factory.create(:voie_defaut)

ArgumentError: wrong number of arguments (0 for 3)


Problem was that factory_girl did swallow the stacktrace!!! I had to run it in RAILS_ENV=test script/console to see the exact cause:

from .rvm/gems/ruby-1.8.7-p302@epices/gems/factory_girl-2.0.0.beta1/lib/factory_girl/proxy/build.rb:5:in `initialize'

from .rvm/gems/ruby-1.8.7-p302@epices/gems/factory_girl-2.0.0.beta1/lib/factory_girl/proxy/build.rb:5:in `new'

from .rvm/gems/ruby-1.8.7-p302@epices/gems/factory_girl-2.0.0.beta1/lib/factory_girl/proxy/build.rb:5:in `initialize'

from .rvm/gems/ruby-1.8.7-p302@epices/gems/factory_girl-2.0.0.beta1/lib/factory_girl/factory.rb:93:in `new'

from .rvm/gems/ruby-1.8.7-p302@epices/gems/factory_girl-2.0.0.beta1/lib/factory_girl/factory.rb:93:in `run'

from .rvm/gems/ruby-1.8.7-p302@epices/gems/factory_girl-2.0.0.beta1/lib/factory_girl/syntax/vintage.rb:86:in `create'

from (irb):1

It turned out that in this legacy project, a Rails developper wanabee had implemented a constructor to an AR model with 3 parameters ...