Skip to content

Commit 1079106

Browse files
committed
Fix InternalAffairs/MethodNameEqual
1 parent 1be4c09 commit 1079106

File tree

7 files changed

+9
-14
lines changed

7 files changed

+9
-14
lines changed

.rubocop_todo.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2019-12-12 15:15:34 +0200 using RuboCop version 0.77.0.
3+
# on 2020-07-15 15:15:30 UTC using RuboCop version 0.87.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 9
10-
# Cop supports --auto-correct.
11-
InternalAffairs/MethodNameEqual:
12-
Enabled: false
13-
149
# Offense count: 1
15-
# Configuration parameters: CountComments.
10+
# Configuration parameters: CountComments, CountAsOne.
1611
Metrics/ClassLength:
1712
Max: 106

lib/rubocop/cop/rspec/described_class.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def offensive?(node)
142142
if style == :described_class
143143
offensive_described_class?(node)
144144
else
145-
node.send_type? && node.method_name == :described_class
145+
node.send_type? && node.method?(:described_class)
146146
end
147147
end
148148

lib/rubocop/cop/rspec/implicit_subject.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def valid_usage?(node)
6363
example = node.ancestors.find { |parent| example?(parent) }
6464
return false if example.nil?
6565

66-
example.method_name == :its || allowed_by_style?(example)
66+
example.method?(:its) || allowed_by_style?(example)
6767
end
6868

6969
def allowed_by_style?(example)

lib/rubocop/cop/rspec/predicate_matcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def to_predicate_method(matcher)
219219
# rubocop:enable Metrics/MethodLength
220220

221221
def replacement_matcher(node)
222-
case [cop_config['Strict'], node.method_name == :to]
222+
case [cop_config['Strict'], node.method?(:to)]
223223
when [true, true]
224224
'be(true)'
225225
when [true, false]

lib/rubocop/cop/rspec/receive_never.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ReceiveNever < Cop
2020
def_node_search :method_on_stub?, '(send nil? :receive ...)'
2121

2222
def on_send(node)
23-
return unless node.method_name == :never && method_on_stub?(node)
23+
return unless node.method?(:never) && method_on_stub?(node)
2424

2525
add_offense(node.loc.selector) do |corrector|
2626
autocorrect(corrector, node)

lib/rubocop/cop/rspec/repeated_example.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def repeated_examples(node)
4141
def example_signature(example)
4242
key_parts = [example.metadata, example.implementation]
4343

44-
if example.definition.method_name == :its
44+
if example.definition.method?(:its)
4545
key_parts << example.definition.arguments
4646
end
4747

lib/rubocop/rspec/top_level_describe.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def on_send(node)
1616
private
1717

1818
def top_level_describe?(node)
19-
return false unless node.method_name == :describe
19+
return false unless node.method?(:describe)
2020

2121
top_level_nodes.include?(node)
2222
end
@@ -44,7 +44,7 @@ def single_top_level_describe?
4444

4545
def describe_statement_children(node)
4646
node.each_child_node(:send).select do |element|
47-
element.method_name == :describe
47+
element.method?(:describe)
4848
end
4949
end
5050
end

0 commit comments

Comments
 (0)