rubocop-rspec 1.41.0 → 1.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -2
  3. data/config/default.yml +41 -3
  4. data/lib/rubocop-rspec.rb +2 -1
  5. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +12 -19
  6. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +12 -19
  7. data/lib/rubocop/cop/rspec/any_instance.rb +1 -1
  8. data/lib/rubocop/cop/rspec/around_block.rb +2 -2
  9. data/lib/rubocop/cop/rspec/base.rb +76 -0
  10. data/lib/rubocop/cop/rspec/be.rb +2 -2
  11. data/lib/rubocop/cop/rspec/be_eql.rb +6 -6
  12. data/lib/rubocop/cop/rspec/before_after_all.rb +1 -1
  13. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +19 -17
  14. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +14 -12
  15. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +1 -1
  16. data/lib/rubocop/cop/rspec/context_method.rb +7 -9
  17. data/lib/rubocop/cop/rspec/context_wording.rb +3 -3
  18. data/lib/rubocop/cop/rspec/cop.rb +2 -66
  19. data/lib/rubocop/cop/rspec/describe_class.rb +40 -30
  20. data/lib/rubocop/cop/rspec/describe_method.rb +14 -6
  21. data/lib/rubocop/cop/rspec/describe_symbol.rb +2 -2
  22. data/lib/rubocop/cop/rspec/described_class.rb +12 -9
  23. data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +1 -1
  24. data/lib/rubocop/cop/rspec/dialect.rb +5 -12
  25. data/lib/rubocop/cop/rspec/empty_example_group.rb +124 -6
  26. data/lib/rubocop/cop/rspec/empty_hook.rb +6 -10
  27. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +5 -7
  28. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +5 -9
  29. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +8 -8
  30. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +5 -9
  31. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +6 -6
  32. data/lib/rubocop/cop/rspec/example_length.rb +1 -1
  33. data/lib/rubocop/cop/rspec/example_without_description.rb +1 -1
  34. data/lib/rubocop/cop/rspec/example_wording.rb +10 -11
  35. data/lib/rubocop/cop/rspec/expect_actual.rb +8 -11
  36. data/lib/rubocop/cop/rspec/expect_change.rb +10 -35
  37. data/lib/rubocop/cop/rspec/expect_in_hook.rb +3 -3
  38. data/lib/rubocop/cop/rspec/expect_output.rb +2 -2
  39. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +20 -20
  40. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +20 -22
  41. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +7 -8
  42. data/lib/rubocop/cop/rspec/file_path.rb +25 -17
  43. data/lib/rubocop/cop/rspec/focus.rb +7 -11
  44. data/lib/rubocop/cop/rspec/hook_argument.rb +16 -23
  45. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +13 -14
  46. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +2 -3
  47. data/lib/rubocop/cop/rspec/implicit_expect.rb +7 -15
  48. data/lib/rubocop/cop/rspec/implicit_subject.rb +16 -11
  49. data/lib/rubocop/cop/rspec/instance_spy.rb +18 -12
  50. data/lib/rubocop/cop/rspec/instance_variable.rb +1 -1
  51. data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +3 -6
  52. data/lib/rubocop/cop/rspec/it_behaves_like.rb +5 -6
  53. data/lib/rubocop/cop/rspec/iterated_expectation.rb +1 -1
  54. data/lib/rubocop/cop/rspec/leading_subject.rb +27 -20
  55. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -1
  56. data/lib/rubocop/cop/rspec/let_before_examples.rb +13 -11
  57. data/lib/rubocop/cop/rspec/let_setup.rb +6 -3
  58. data/lib/rubocop/cop/rspec/message_chain.rb +7 -6
  59. data/lib/rubocop/cop/rspec/message_expectation.rb +2 -2
  60. data/lib/rubocop/cop/rspec/message_spies.rb +2 -3
  61. data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +1 -1
  62. data/lib/rubocop/cop/rspec/multiple_describes.rb +11 -8
  63. data/lib/rubocop/cop/rspec/multiple_expectations.rb +7 -11
  64. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +148 -0
  65. data/lib/rubocop/cop/rspec/multiple_subjects.rb +18 -19
  66. data/lib/rubocop/cop/rspec/named_subject.rb +2 -2
  67. data/lib/rubocop/cop/rspec/nested_groups.rb +4 -4
  68. data/lib/rubocop/cop/rspec/not_to_not.rb +5 -6
  69. data/lib/rubocop/cop/rspec/overwriting_setup.rb +1 -1
  70. data/lib/rubocop/cop/rspec/pending.rb +1 -1
  71. data/lib/rubocop/cop/rspec/predicate_matcher.rb +30 -67
  72. data/lib/rubocop/cop/rspec/rails/http_status.rb +5 -9
  73. data/lib/rubocop/cop/rspec/receive_counts.rb +15 -17
  74. data/lib/rubocop/cop/rspec/receive_never.rb +12 -12
  75. data/lib/rubocop/cop/rspec/repeated_description.rb +1 -1
  76. data/lib/rubocop/cop/rspec/repeated_example.rb +2 -2
  77. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +1 -1
  78. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +1 -1
  79. data/lib/rubocop/cop/rspec/repeated_include_example.rb +103 -0
  80. data/lib/rubocop/cop/rspec/return_from_stub.rb +9 -20
  81. data/lib/rubocop/cop/rspec/scattered_let.rb +8 -11
  82. data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
  83. data/lib/rubocop/cop/rspec/shared_context.rb +8 -21
  84. data/lib/rubocop/cop/rspec/shared_examples.rb +6 -9
  85. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +15 -18
  86. data/lib/rubocop/cop/rspec/stubbed_mock.rb +172 -0
  87. data/lib/rubocop/cop/rspec/subject_stub.rb +6 -6
  88. data/lib/rubocop/cop/rspec/unspecified_exception.rb +1 -1
  89. data/lib/rubocop/cop/rspec/variable_definition.rb +6 -6
  90. data/lib/rubocop/cop/rspec/variable_name.rb +28 -9
  91. data/lib/rubocop/cop/rspec/verified_doubles.rb +1 -1
  92. data/lib/rubocop/cop/rspec/void_expect.rb +1 -1
  93. data/lib/rubocop/cop/rspec/yield.rb +14 -11
  94. data/lib/rubocop/cop/rspec_cops.rb +3 -0
  95. data/lib/rubocop/rspec/corrector/move_node.rb +7 -5
  96. data/lib/rubocop/rspec/description_extractor.rb +1 -1
  97. data/lib/rubocop/rspec/{blank_line_separation.rb → empty_line_separation.rb} +13 -10
  98. data/lib/rubocop/rspec/example_group.rb +2 -2
  99. data/lib/rubocop/rspec/hook.rb +1 -5
  100. data/lib/rubocop/rspec/language.rb +12 -5
  101. data/lib/rubocop/rspec/language/node_pattern.rb +6 -1
  102. data/lib/rubocop/rspec/top_level_describe.rb +2 -2
  103. data/lib/rubocop/rspec/top_level_group.rb +26 -13
  104. data/lib/rubocop/rspec/variable.rb +1 -1
  105. data/lib/rubocop/rspec/version.rb +1 -1
  106. metadata +40 -8
@@ -33,7 +33,8 @@ module RuboCop
33
33
  # - If subjects are defined with `subject!` then we don't autocorrect.
34
34
  # This is enough of an edge case that people can just move this to
35
35
  # a `before` hook on their own
36
- class MultipleSubjects < Cop
36
+ class MultipleSubjects < Base
37
+ extend AutoCorrector
37
38
  include RangeHelp
38
39
 
39
40
  MSG = 'Do not set more than one subject per example group'
@@ -44,38 +45,36 @@ module RuboCop
44
45
  subjects = RuboCop::RSpec::ExampleGroup.new(node).subjects
45
46
 
46
47
  subjects[0...-1].each do |subject|
47
- add_offense(subject)
48
+ add_offense(subject) do |corrector|
49
+ autocorrect(corrector, subject)
50
+ end
48
51
  end
49
52
  end
50
53
 
51
- def autocorrect(node)
52
- return unless node.method_name.equal?(:subject) # Ignore `subject!`
54
+ private
55
+
56
+ def autocorrect(corrector, subject)
57
+ return unless subject.method_name.equal?(:subject) # Ignore `subject!`
53
58
 
54
- if named_subject?(node)
55
- rename_autocorrect(node)
59
+ if named_subject?(subject)
60
+ rename_autocorrect(corrector, subject)
56
61
  else
57
- remove_autocorrect(node)
62
+ remove_autocorrect(corrector, subject)
58
63
  end
59
64
  end
60
65
 
61
- private
62
-
63
66
  def named_subject?(node)
64
67
  node.send_node.arguments?
65
68
  end
66
69
 
67
- def rename_autocorrect(node)
68
- lambda do |corrector|
69
- corrector.replace(node.send_node.loc.selector, 'let')
70
- end
70
+ def rename_autocorrect(corrector, node)
71
+ corrector.replace(node.send_node.loc.selector, 'let')
71
72
  end
72
73
 
73
- def remove_autocorrect(node)
74
- lambda do |corrector|
75
- range = range_by_whole_lines(node.source_range,
76
- include_final_newline: true)
77
- corrector.remove(range)
78
- end
74
+ def remove_autocorrect(corrector, node)
75
+ range = range_by_whole_lines(node.source_range,
76
+ include_final_newline: true)
77
+ corrector.remove(range)
79
78
  end
80
79
  end
81
80
  end
@@ -41,7 +41,7 @@ module RuboCop
41
41
  #
42
42
  # it { is_expected.to be_valid }
43
43
  # end
44
- class NamedSubject < Cop
44
+ class NamedSubject < Base
45
45
  MSG = 'Name your test subject if you need '\
46
46
  'to reference it explicitly.'
47
47
 
@@ -62,7 +62,7 @@ module RuboCop
62
62
  return if !rspec_block?(node) || ignored_shared_example?(node)
63
63
 
64
64
  subject_usage(node) do |subject_node|
65
- add_offense(subject_node, location: :selector)
65
+ add_offense(subject_node.loc.selector)
66
66
  end
67
67
  end
68
68
 
@@ -85,9 +85,9 @@ module RuboCop
85
85
  # end
86
86
  # end
87
87
  #
88
- class NestedGroups < Cop
88
+ class NestedGroups < Base
89
89
  include ConfigurableMax
90
- include RuboCop::RSpec::TopLevelDescribe
90
+ include RuboCop::RSpec::TopLevelGroup
91
91
 
92
92
  MSG = 'Maximum example group nesting exceeded [%<total>d/%<max>d].'
93
93
 
@@ -97,8 +97,8 @@ module RuboCop
97
97
  "Configuration key `#{DEPRECATED_MAX_KEY}` for #{cop_name} is " \
98
98
  'deprecated in favor of `Max`. Please use that instead.'
99
99
 
100
- def on_top_level_describe(node, _args)
101
- find_nested_example_groups(node.parent) do |example_group, nesting|
100
+ def on_top_level_group(node)
101
+ find_nested_example_groups(node) do |example_group, nesting|
102
102
  self.max = nesting
103
103
  add_offense(
104
104
  example_group.send_node,
@@ -15,7 +15,8 @@ module RuboCop
15
15
  # it '...' do
16
16
  # expect(false).not_to be_true
17
17
  # end
18
- class NotToNot < Cop
18
+ class NotToNot < Base
19
+ extend AutoCorrector
19
20
  include ConfigurableEnforcedStyle
20
21
 
21
22
  MSG = 'Prefer `%<replacement>s` over `%<original>s`.'
@@ -24,14 +25,12 @@ module RuboCop
24
25
 
25
26
  def on_send(node)
26
27
  not_to_not_offense(node, alternative_style) do
27
- add_offense(node, location: :selector)
28
+ add_offense(node.loc.selector) do |corrector|
29
+ corrector.replace(node.loc.selector, style.to_s)
30
+ end
28
31
  end
29
32
  end
30
33
 
31
- def autocorrect(node)
32
- ->(corrector) { corrector.replace(node.loc.selector, style.to_s) }
33
- end
34
-
35
34
  private
36
35
 
37
36
  def message(_node)
@@ -21,7 +21,7 @@ module RuboCop
21
21
  # let(:foo) { bar }
22
22
  # let(:baz) { baz }
23
23
  # let!(:other) { other }
24
- class OverwritingSetup < Cop
24
+ class OverwritingSetup < Base
25
25
  MSG = '`%<name>s` is already defined.'
26
26
 
27
27
  def_node_matcher :setup?, (Helpers::ALL + Subject::ALL).block_pattern
@@ -31,7 +31,7 @@ module RuboCop
31
31
  # # good
32
32
  # describe MyClass do
33
33
  # end
34
- class Pending < Cop
34
+ class Pending < Base
35
35
  MSG = 'Pending spec found.'
36
36
 
37
37
  PENDING = Examples::PENDING + Examples::SKIPPED + ExampleGroups::SKIPPED
@@ -14,11 +14,14 @@ module RuboCop
14
14
  private
15
15
 
16
16
  def check_inflected(node)
17
- predicate_in_actual?(node) do |predicate|
18
- add_offense(
19
- node,
20
- message: message_inflected(predicate)
21
- )
17
+ predicate_in_actual?(node) do |predicate, to, matcher|
18
+ msg = message_inflected(predicate)
19
+ add_offense(node, message: msg) do |corrector|
20
+ remove_predicate(corrector, predicate)
21
+ corrector.replace(node.loc.selector,
22
+ true?(to, matcher) ? 'to' : 'not_to')
23
+ rewrite_matcher(corrector, predicate, matcher)
24
+ end
22
25
  end
23
26
  end
24
27
 
@@ -76,17 +79,6 @@ module RuboCop
76
79
  end
77
80
  # rubocop:enable Metrics/MethodLength
78
81
 
79
- def autocorrect_inflected(node)
80
- predicate_in_actual?(node) do |predicate, to, matcher|
81
- lambda do |corrector|
82
- remove_predicate(corrector, predicate)
83
- corrector.replace(node.loc.selector,
84
- true?(to, matcher) ? 'to' : 'not_to')
85
- rewrite_matcher(corrector, predicate, matcher)
86
- end
87
- end
88
- end
89
-
90
82
  def remove_predicate(corrector, predicate)
91
83
  range = predicate.loc.dot.with(
92
84
  end_pos: predicate.loc.expression.end_pos
@@ -123,7 +115,6 @@ module RuboCop
123
115
  end
124
116
 
125
117
  # A helper for `explicit` style
126
- # rubocop:disable Metrics/ModuleLength
127
118
  module ExplicitHelper
128
119
  include RuboCop::RSpec::Language
129
120
  extend NodePattern::Macros
@@ -143,22 +134,21 @@ module RuboCop
143
134
  end
144
135
 
145
136
  def check_explicit(node) # rubocop:disable Metrics/MethodLength
146
- predicate_matcher_block?(node) do |_actual, matcher|
147
- add_offense(
148
- node,
149
- message: message_explicit(matcher)
150
- )
137
+ predicate_matcher_block?(node) do |actual, matcher|
138
+ add_offense(node, message: message_explicit(matcher)) do |corrector|
139
+ to_node = node.send_node
140
+ corrector_explicit(corrector, to_node, actual, matcher, to_node)
141
+ end
151
142
  ignore_node(node.children.first)
152
143
  return
153
144
  end
154
145
 
155
146
  return if part_of_ignored_node?(node)
156
147
 
157
- predicate_matcher?(node) do |_actual, matcher|
158
- add_offense(
159
- node,
160
- message: message_explicit(matcher)
161
- )
148
+ predicate_matcher?(node) do |actual, matcher|
149
+ add_offense(node, message: message_explicit(matcher)) do |corrector|
150
+ corrector_explicit(corrector, node, actual, matcher, matcher)
151
+ end
162
152
  end
163
153
  end
164
154
 
@@ -193,31 +183,11 @@ module RuboCop
193
183
  matcher_name: matcher.method_name)
194
184
  end
195
185
 
196
- def autocorrect_explicit(node)
197
- autocorrect_explicit_send(node) ||
198
- autocorrect_explicit_block(node)
199
- end
200
-
201
- def autocorrect_explicit_send(node)
202
- predicate_matcher?(node) do |actual, matcher|
203
- corrector_explicit(node, actual, matcher, matcher)
204
- end
205
- end
206
-
207
- def autocorrect_explicit_block(node)
208
- predicate_matcher_block?(node) do |actual, matcher|
209
- to_node = node.send_node
210
- corrector_explicit(to_node, actual, matcher, to_node)
211
- end
212
- end
213
-
214
- def corrector_explicit(to_node, actual, matcher, block_child)
215
- lambda do |corrector|
216
- replacement_matcher = replacement_matcher(to_node)
217
- corrector.replace(matcher.loc.expression, replacement_matcher)
218
- move_predicate(corrector, actual, matcher, block_child)
219
- corrector.replace(to_node.loc.selector, 'to')
220
- end
186
+ def corrector_explicit(corrector, to_node, actual, matcher, block_child)
187
+ replacement_matcher = replacement_matcher(to_node)
188
+ corrector.replace(matcher.loc.expression, replacement_matcher)
189
+ move_predicate(corrector, actual, matcher, block_child)
190
+ corrector.replace(to_node.loc.selector, 'to')
221
191
  end
222
192
 
223
193
  def move_predicate(corrector, actual, matcher, block_child)
@@ -238,18 +208,20 @@ module RuboCop
238
208
  'is_a?'
239
209
  when 'be_an_instance_of', 'be_instance_of', 'an_instance_of'
240
210
  'instance_of?'
241
- when 'include', 'respond_to'
242
- matcher + '?'
211
+ when 'include'
212
+ 'include?'
213
+ when 'respond_to'
214
+ 'respond_to?'
243
215
  when /^have_(.+)/
244
216
  "has_#{Regexp.last_match(1)}?"
245
217
  else
246
- matcher[/^be_(.+)/, 1] + '?'
218
+ "#{matcher[/^be_(.+)/, 1]}?"
247
219
  end
248
220
  end
249
221
  # rubocop:enable Metrics/MethodLength
250
222
 
251
223
  def replacement_matcher(node)
252
- case [cop_config['Strict'], node.method_name == :to]
224
+ case [cop_config['Strict'], node.method?(:to)]
253
225
  when [true, true]
254
226
  'be(true)'
255
227
  when [true, false]
@@ -261,7 +233,6 @@ module RuboCop
261
233
  end
262
234
  end
263
235
  end
264
- # rubocop:enable Metrics/ModuleLength
265
236
 
266
237
  # Prefer using predicate matcher over using predicate method directly.
267
238
  #
@@ -300,7 +271,8 @@ module RuboCop
300
271
  #
301
272
  # # good - the above code is rewritten to it by this cop
302
273
  # expect(foo.something?).to be_truthy
303
- class PredicateMatcher < Cop
274
+ class PredicateMatcher < Base
275
+ extend AutoCorrector
304
276
  include ConfigurableEnforcedStyle
305
277
  include InflectedHelper
306
278
  include ExplicitHelper
@@ -318,15 +290,6 @@ module RuboCop
318
290
  check_explicit(node) if style == :explicit
319
291
  end
320
292
 
321
- def autocorrect(node)
322
- case style
323
- when :inflected
324
- autocorrect_inflected(node)
325
- when :explicit
326
- autocorrect_explicit(node)
327
- end
328
- end
329
-
330
293
  private
331
294
 
332
295
  # returns args location with whitespace
@@ -30,7 +30,8 @@ module RuboCop
30
30
  # it { is_expected.to have_http_status :success }
31
31
  # it { is_expected.to have_http_status :error }
32
32
  #
33
- class HttpStatus < Cop
33
+ class HttpStatus < Base
34
+ extend AutoCorrector
34
35
  include ConfigurableEnforcedStyle
35
36
 
36
37
  def_node_matcher :http_status, <<-PATTERN
@@ -42,14 +43,9 @@ module RuboCop
42
43
  checker = checker_class.new(ast_node)
43
44
  return unless checker.offensive?
44
45
 
45
- add_offense(checker.node, message: checker.message)
46
- end
47
- end
48
-
49
- def autocorrect(node)
50
- lambda do |corrector|
51
- checker = checker_class.new(node)
52
- corrector.replace(node.loc.expression, checker.preferred_style)
46
+ add_offense(checker.node, message: checker.message) do |corrector|
47
+ corrector.replace(checker.node, checker.preferred_style)
48
+ end
53
49
  end
54
50
  end
55
51
 
@@ -23,7 +23,9 @@ module RuboCop
23
23
  # expect(foo).to receive(:bar).at_most(:once)
24
24
  # expect(foo).to receive(:bar).at_most(:twice).times
25
25
  #
26
- class ReceiveCounts < Cop
26
+ class ReceiveCounts < Base
27
+ extend AutoCorrector
28
+
27
29
  MSG = 'Use `%<alternative>s` instead of `%<original>s`.'
28
30
 
29
31
  def_node_matcher :receive_counts, <<-PATTERN
@@ -38,27 +40,23 @@ module RuboCop
38
40
 
39
41
  offending_range = range(node, offending_node)
40
42
 
41
- add_offense(
42
- offending_node,
43
- message: message_for(offending_node, offending_range.source),
44
- location: offending_range
45
- )
43
+ msg = message_for(offending_node, offending_range.source)
44
+ add_offense(offending_range, message: msg) do |corrector|
45
+ autocorrect(corrector, offending_node, offending_range)
46
+ end
46
47
  end
47
48
  end
48
49
 
49
- def autocorrect(node)
50
- lambda do |corrector|
51
- replacement = matcher_for(
52
- node.method_name,
53
- node.first_argument.source.to_i
54
- )
50
+ private
55
51
 
56
- original = range(node.parent, node)
57
- corrector.replace(original, replacement)
58
- end
59
- end
52
+ def autocorrect(corrector, node, range)
53
+ replacement = matcher_for(
54
+ node.method_name,
55
+ node.first_argument.source.to_i
56
+ )
60
57
 
61
- private
58
+ corrector.replace(range, replacement)
59
+ end
62
60
 
63
61
  def message_for(node, source)
64
62
  alternative = matcher_for(
@@ -13,26 +13,26 @@ module RuboCop
13
13
  # # good
14
14
  # expect(foo).not_to receive(:bar)
15
15
  #
16
- class ReceiveNever < Cop
16
+ class ReceiveNever < Base
17
+ extend AutoCorrector
17
18
  MSG = 'Use `not_to receive` instead of `never`.'
18
19
 
19
20
  def_node_search :method_on_stub?, '(send nil? :receive ...)'
20
21
 
21
22
  def on_send(node)
22
- return unless node.method_name == :never && method_on_stub?(node)
23
+ return unless node.method?(:never) && method_on_stub?(node)
23
24
 
24
- add_offense(
25
- node,
26
- location: :selector
27
- )
25
+ add_offense(node.loc.selector) do |corrector|
26
+ autocorrect(corrector, node)
27
+ end
28
28
  end
29
29
 
30
- def autocorrect(node)
31
- lambda do |corrector|
32
- corrector.replace(node.parent.loc.selector, 'not_to')
33
- range = node.loc.dot.with(end_pos: node.loc.selector.end_pos)
34
- corrector.remove(range)
35
- end
30
+ private
31
+
32
+ def autocorrect(corrector, node)
33
+ corrector.replace(node.parent.loc.selector, 'not_to')
34
+ range = node.loc.dot.with(end_pos: node.loc.selector.end_pos)
35
+ corrector.remove(range)
36
36
  end
37
37
  end
38
38
  end
@@ -40,7 +40,7 @@ module RuboCop
40
40
  # end
41
41
  # end
42
42
  #
43
- class RepeatedDescription < Cop
43
+ class RepeatedDescription < Base
44
44
  MSG = "Don't repeat descriptions within an example group."
45
45
 
46
46
  def on_block(node)