Skip to content

Change 'FactoryGirl' references to 'FactoryBot'  #26

@JamesFrost

Description

@JamesFrost

After using the Rails Composer tool to generate a starter app, the rails server command exits with the following error:

$ rails server
=> Booting Puma
=> Rails 5.1.4 application starting in development 
=> Run `rails server -h` for more startup options
Exiting
/Users/jamesfrost/example-app/spec/factories/users.rb:1:in `<top (required)>': uninitialized constant FactoryGirl (NameError)
	from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:20:in `block (2 levels) in find_definitions'
	from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:19:in `each'
	from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:19:in `block in find_definitions'
	from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:15:in `each'
	from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:15:in `find_definitions'
	from /Library/Ruby/Gems/2.3.0/gems/factory_bot_rails-4.8.2/lib/factory_bot_rails/railtie.rb:21:in `block in <class:Railtie>'
	from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook'
	from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
	from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
	from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
	from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
	from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
	from /Users/jamesfrost/example-app/config/environment.rb:5:in `<top (required)>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
	from config.ru:in `new'
	from config.ru:in `<main>'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:24:in `app'
	from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:42:in `start'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:in `block in perform'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
	from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
	from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
	from /Users/jamesfrost/example-app/bin/rails:9:in `require'
	from /Users/jamesfrost/example-app/bin/rails:9:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
	from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
	from /Users/jamesfrost/example-app/bin/spring:15:in `<top (required)>'
	from bin/rails:3:in `load'
	from bin/rails:3:in `<main>'

The FactoryGirl project has recently changed its name to FactoryBot; after replacing all references to FactoryGirl with FactoryBot, the server runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions