You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/upgrade_to_version_2.adoc
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ In version 2.x:
7
7
8
8
- `RSpec/InvalidPredicateMatcher` cop is removed
9
9
- `CustomIncludeMethods` configuration option for `RSpec/EmptyExampleGroup` is removed
10
-
- cop departments are nested for cops with a department that doesn't match the extension name (`Capybara`, `FactoryBot`, `Rails`)
10
+
- cop departments are nested for cops with a department that doesn’t match the extension name (`Capybara`, `FactoryBot`, `Rails`)
11
11
12
12
[discrete]
13
13
=== Adjust the configuration of `RSpec/EmptyExampleGroup`
@@ -34,8 +34,8 @@ AllCops:
34
34
35
35
RuboCop extensions had cops with clashing names and departments, e.g. both `rspec-rails` and `rubocop-rspec` had `Rails::HttpStatus` cops.
36
36
To avoid issues, e.g. inability to disable just one of the cops, each extension now has its own uber-department.
37
-
Expectedly, RuboCop RSpec's uber-department name is `RSpec`.
38
-
Changes are only applied to cops that don't already have the department set to `RSpec`, i.e. `Capybara`, `FactoryBot` and `Rails`.
37
+
Expectedly, RuboCop RSpec’s uber-department name is `RSpec`.
38
+
Changes are only applied to cops that don’t already have the department set to `RSpec`, i.e. `Capybara`, `FactoryBot` and `Rails`.
39
39
40
40
[source,yaml]
41
41
----
@@ -68,14 +68,14 @@ https://github.com/rubocop-hq/rubocop/pull/8490[Learn more about this change].
68
68
69
69
== Custom Cop Update Guide
70
70
71
-
Due to significant API changes custom cops will break.
71
+
Due to significant API changes, custom cops may break.
72
72
Here is the summary of the changes:
73
73
74
74
1) The base class for cops is now `RuboCop::Cop::RSpec::Base` instead of `RuboCop::Cop::RSpec::Cop`.
75
75
76
76
2) `TopLevelDescribe` is replaced with a more generic `TopLevelGroup`.
77
77
78
-
3) `RuboCop::RSpec::Language` has been completely rewritten to support dynamic RSpec DSL aliases and negated matchers to fully support third-party libraries e.g. RSpec Rails, Pundit, Action Policy and many others.
78
+
3) `RuboCop::RSpec::Language` has been completely rewritten to support dynamic RSpec DSL aliases and negated matchers to fully support third-party libraries such as RSpec Rails, Pundit, Action Policy and many others.
79
79
80
80
4) RuboCop RSpec updated the dependency of RuboCop to 1.0+.
`TopLevelDescribe` was incomplete, had poor performance and did not distinguish between example groups and shared example groups.
110
110
111
111
`TopLevelGroup` provides a similar interface, but instead of a single `on_top_level_describe` hook there are two, `on_top_level_example_group` and `on_top_level_group`.
112
-
There's no need yet for `on_top_level_shared_group` for RuboCop core cops, but if your custom cop needs such a hook, please feel free to send a pull request.
112
+
There’s no need yet for `on_top_level_shared_group` for RuboCop core cops, but if your custom cop needs such a hook, please feel free to send a pull request.
113
113
114
114
Additionally, `single_top_level_describe?` is removed with no direct replacement.
115
115
You may use `top_level_groups` query method instead, e.g. `top_level_groups.one?`.
0 commit comments