lib/rubocop/cop/rspec/expect_actual.rb in rubocop-rspec-2.26.1 vs lib/rubocop/cop/rspec/expect_actual.rb in rubocop-rspec-2.27.0
- old
+ new
@@ -48,11 +48,12 @@
irange
erange
regexp
].freeze
- SUPPORTED_MATCHERS = %i[eq eql equal be].freeze
+ SKIPPED_MATCHERS = %i[route_to be_routable].freeze
+ CORRECTABLE_MATCHERS = %i[eq eql equal be].freeze
# @!method expect_literal(node)
def_node_matcher :expect_literal, <<~PATTERN
(send
(send nil? :expect $#literal?)
@@ -64,11 +65,13 @@
)
PATTERN
def on_send(node)
expect_literal(node) do |actual, matcher, expected|
+ next if SKIPPED_MATCHERS.include?(matcher)
+
add_offense(actual.source_range) do |corrector|
- next unless SUPPORTED_MATCHERS.include?(matcher)
+ next unless CORRECTABLE_MATCHERS.include?(matcher)
next if literal?(expected)
swap(corrector, actual, expected)
end
end