lib/rubocop/cop/rspec/message_spies.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/message_spies.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -35,23 +35,25 @@
' or `instance_spy`.'.freeze
SUPPORTED_STYLES = %w[have_received receive].freeze
def_node_matcher :message_expectation, %(
- (send (send nil :expect $_) {:to :to_not :not_to} ...)
+ (send (send nil? :expect $_) {:to :to_not :not_to} ...)
)
def_node_search :receive_message, %(
- $(send nil {:receive :have_received} ...)
+ $(send nil? {:receive :have_received} ...)
)
def on_send(node)
receive_message_matcher(node) do |receiver, message_matcher|
return correct_style_detected if preferred_style?(message_matcher)
- add_offense(message_matcher, :selector, error_message(receiver)) do
- opposite_style_detected
- end
+ add_offense(
+ message_matcher,
+ location: :selector,
+ message: error_message(receiver)
+ ) { opposite_style_detected }
end
end
private