Search code examples
ruby-on-rails-3.1rubygemsfactory-botwebrick

Freshly installed gem (FactoryGirl) causes WEBrick to exit (DEPRECATION WARNING)


trying to start WEBrick:

rails s

=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
DEPRECATION WARNING: Change Factory.define to FactoryGirl.define
Exiting
/home/shawn/.rvm/gems/ruby-1.9.2-p318/gems/factory_girl-2.6.1/lib/factory_girl/syntax/default.rb:6:in `define': wrong number of arguments (1 for 0) (ArgumentError)
    from /home/shawn/.rvm/gems/ruby-1.9.2-p318/gems/factory_girl-2.6.1/lib/factory_girl/deprecated.rb:5:in `method_missing'

It's surprising to me because everything is freshly installed, and the same gemset works perfectly for others sharing the repository.


Solution

  • From the ThoughtBot website http://robots.thoughtbot.com/post/7176629856/factory-girls-new-look

    Notice this diff it looks like they ran into the same issue.

    Somewhere you or someone is making a call to Factory.define when you should be calling FactoryGirl.define

    grep -ir 'Factory.define' * from the application root directory should give you more details of exactly where you're making that mistake. If it doesn't return anything then you know it's not your app, it's some Gem (which is what the trace shows).

    If that's the case I'd try gem uninstall factory_girl and gem install factory_girl to get a fresh version.