-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: #1823
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
---- |