title: RSpec factories with FactoryBot 'uninitialized constant FactoryBot'
body: <p>I am setting up request specs following <a href="https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one" rel="nofollow noreferrer">this tutorial</a>. 
  If I run the tests with <code>bundle exec rspec</code> I get the following error:</p>
  
  <pre><code>An error occurred while loading ./spec/factories/entities_spec.rb.
  Failure/Error:
    FactoryBot.define do
      factory :entity do
        name { FFaker::Lorem.word }
      end
    end
  
  NameError:
    uninitialized constant FactoryBot
  </code></pre>
  
  <p>The tutorial only asks to add some configuration to the rails_helper.rb file. I can't figure where I need to add a <code>require 'factory_bot'</code>. If I add it to the top of the rails_helper.rb file, the error persists. And if I add it to the factories/entity_spec.rb file, I get this error:</p>
  
  <pre><code>An error occurred while loading ./spec/requests/entities_spec.rb.
  Failure/Error:
    factory :entity do
      name { FFaker::Lorem.word }
    end
  
  FactoryBot::DuplicateDefinitionError:
    Factory already registered: entity
  </code></pre>