-
-
Notifications
You must be signed in to change notification settings - Fork 278
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 use sinatra 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 | ||
|
||
For the next three divisions, RuboCop RSpec v3.0 plans are underway to extract them to other gems. | ||
|
||
[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 disabled old department in `.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 if update to RuboCop RSpec v3.0.0, you need to remove the old department from your `.rubocop.yml` file. In short, you can remove the following lines from your `.rubocop.yml` file: | ||
|
||
[source,yaml] | ||
---- | ||
RSpec/Capybara: | ||
Enabled: false | ||
RSpec/FactoryBot: | ||
Enabled: false | ||
---- |