lib/rubocop/cop/rspec/shared_context.rb in rubocop-rspec-1.27.0 vs lib/rubocop/cop/rspec/shared_context.rb in rubocop-rspec-1.28.0
- old
+ new
@@ -66,15 +66,15 @@
def_node_matcher :shared_context, SharedGroups::CONTEXT.block_pattern
def_node_matcher :shared_example, SharedGroups::EXAMPLES.block_pattern
def on_block(node)
context_with_only_examples(node) do
- add_shared_item_offense(node, MSG_EXAMPLES)
+ add_shared_item_offense(node.send_node, MSG_EXAMPLES)
end
examples_with_only_context(node) do
- add_shared_item_offense(node, MSG_CONTEXT)
+ add_shared_item_offense(node.send_node, MSG_CONTEXT)
end
end
def autocorrect(node)
lambda do |corrector|
@@ -98,10 +98,10 @@
shared_example(node) { yield if context?(node) && !examples?(node) }
end
def add_shared_item_offense(node, message)
add_offense(
- node.children.first,
+ node,
location: :expression,
message: message
)
end
end