lib/rubocop/cop/rspec/shared_context.rb in rubocop-rspec-2.2.0 vs lib/rubocop/cop/rspec/shared_context.rb in rubocop-rspec-2.3.0
- old
+ new
@@ -54,13 +54,15 @@
extend AutoCorrector
MSG_EXAMPLES = "Use `shared_examples` when you don't define context."
MSG_CONTEXT = "Use `shared_context` when you don't define examples."
+ # @!method examples?(node)
def_node_search :examples?,
send_pattern('{#Includes.examples #Examples.all}')
+ # @!method context?(node)
def_node_search :context?, <<-PATTERN
(
send #rspec? {
#Subjects.all
#Helpers.all
@@ -68,11 +70,13 @@
#Hooks.all
} ...
)
PATTERN
+ # @!method shared_context(node)
def_node_matcher :shared_context,
block_pattern('#SharedGroups.context')
+ # @!method shared_example(node)
def_node_matcher :shared_example,
block_pattern('#SharedGroups.examples')
def on_block(node)
context_with_only_examples(node) do