Upgrade to Version 3.x

Configuration File Update

In version 3.x:

  • cop departments are extracted to another gem. (Capybara, FactoryBot, Rails)

Extraction of cop departments. (Capybara, FactoryBot, Rails)

If you are using the RSpec/Capybara, RSpec/FactoryBot, or RSpec/Rails departments — or have one in a require list in your rubocop.yml — you need to install the corresponding gem and add it to your .rubocop.yml file:

  • Capybara: rubocop-capybara

  • FactoryBot: rubocop-factory_bot

  • Rails: rubocop-rspec_rails

For example, if you are using the RSpec/Capybara department, you need to install the rubocop-capybara gem and add it to your .rubocop.yml file:

# Gemfile
group :test do
  gem 'rubocop-rspec'
  gem 'rubocop-capybara'
end
require:
  - rubocop-rspec
  - rubocop-capybara

And you need to remove the old department in your .rubocop.yml file:

RSpec/Capybara:
  Enabled: false

For another example, if you are not using these departments, you don’t need to do anything. And when you update to RuboCop RSpec v3.0.0, you need to remove the old departments from your .rubocop.yml file, e.g.:

RSpec/Capybara:
  Enabled: false
RSpec/FactoryBot:
  Enabled: false
RSpec/Rails:
  Enabled: false

Troubleshooting

If you’re seeing cannot load such file when running rubocop, even after installing the gems, restart the server with rubocop --restart-server.