lib/rubocop/cop/rspec/message_expectation.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/message_expectation.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -30,19 +30,19 @@
MSG = 'Prefer `%s` for setting message expectations.'.freeze
SUPPORTED_STYLES = %w[allow expect].freeze
def_node_matcher :message_expectation, <<-PATTERN
- (send $(send nil {:expect :allow} ...) :to #receive_message?)
+ (send $(send nil? {:expect :allow} ...) :to #receive_message?)
PATTERN
- def_node_search :receive_message?, '(send nil :receive ...)'
+ def_node_search :receive_message?, '(send nil? :receive ...)'
def on_send(node)
message_expectation(node) do |match|
return correct_style_detected if preferred_style?(match)
- add_offense(match, :selector, MSG % style) do
+ add_offense(match, location: :selector, message: MSG % style) do
opposite_style_detected
end
end
end