diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 0487d48aa..db2d41988 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -1,6 +1,7 @@ * xref:index.adoc[Home] * xref:installation.adoc[Installation] * xref:usage.adoc[Usage] +* xref:departments.adoc[Departments] * xref:cops.adoc[Cops] * xref:upgrade_to_version_2.adoc[Upgrade to 2.x] * xref:third_party_rspec_syntax_extensions.adoc[RSpec syntax extensions in third-party gems] diff --git a/docs/modules/ROOT/pages/departments.adoc b/docs/modules/ROOT/pages/departments.adoc new file mode 100644 index 000000000..d65cf7009 --- /dev/null +++ b/docs/modules/ROOT/pages/departments.adoc @@ -0,0 +1,80 @@ += Departments + +RuboCop RSpec currently has four departments: + +* xref:cops_rspec.adoc[RSpec]: This department checks for RSpec-specific code style. +* xref:cops_rspec_capybara.adoc[RSpec/Capybara]: This department checks for Capybara-specific code style. +* xref:cops_rspec_factorybot.adoc[RSpec/FactoryBot]: This department checks for factory_bot-specific code style. +* xref:cops_rspec_rails.adoc[RSpec/Rails]: This department checks for RSpec-specific code style in Rails applications. + +Each department has its own set of cops. You can enable or disable individual cops within each department. If your project doesn't use factory_bot, and uses Sinatra and not Rails, you can disable the RSpec/FactoryBot and RSpec/Rails departments in your `.rubocop.yml` file: + +[source,yaml] +---- +RSpec/FactoryBot: + Enabled: false + +RSpec/Rails: + Enabled: false +---- + +== Planned to extract to separate gems + +There are plans for extracting the following three departments before RuboCop RSpec v3.0: + +[cols="1, 1, 1"] +|=== +|Department |Extract to |Status + +|RSpec/Capybara +|https://github.com/rubocop/rubocop-capybara[rubocop-capybara] +|Extracted in https://github.com/rubocop/rubocop-rspec/releases/tag/v2.18.0[v2.18.0] + +|RSpec/FactoryBot +|https://github.com/rubocop/rubocop-factory_bot[rubocop-factory_bot] +|Extracted in https://github.com/rubocop/rubocop-rspec/releases/tag/v2.22.0[v2.22.0] + +|RSpec/Rails +|rubocop-rspec-rails +|Not yet extracted +|=== + +=== Migration manual + +If you are using the RSpec/Capybara, RSpec/FactoryBot, or RSpec/Rails departments, you need to install the corresponding gem and add it to your `.rubocop.yml` file. + +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: + +[source,ruby] +---- +# Gemfile +group :test do + gem 'rubocop-rspec' + gem 'rubocop-capybara' +end +---- + +[source,yaml] +---- +Capybara: + Enabled: true +---- + +And you need to disable the old department in your `.rubocop.yml` file: + +[source,yaml] +---- +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.: + +[source,yaml] +---- +RSpec/Capybara: + Enabled: false +RSpec/FactoryBot: + Enabled: false +----