lib/rubocop/cop/rspec/pending.rb in rubocop-rspec-2.0.0.pre vs lib/rubocop/cop/rspec/pending.rb in rubocop-rspec-2.0.0
- old
+ new
@@ -32,23 +32,31 @@
# describe MyClass do
# end
class Pending < Base
MSG = 'Pending spec found.'
- PENDING = Examples::PENDING + Examples::SKIPPED + ExampleGroups::SKIPPED
- SKIPPABLE = ExampleGroups::GROUPS + Examples::EXAMPLES
+ def_node_matcher :skippable?,
+ send_pattern(<<~PATTERN)
+ {#ExampleGroups.regular #Examples.regular}
+ PATTERN
- def_node_matcher :skippable?, SKIPPABLE.send_pattern
-
def_node_matcher :skipped_in_metadata?, <<-PATTERN
{
(send _ _ <#skip_or_pending? ...>)
(send _ _ ... (hash <(pair #skip_or_pending? { true str }) ...>))
}
PATTERN
def_node_matcher :skip_or_pending?, '{(sym :skip) (sym :pending)}'
- def_node_matcher :pending_block?, PENDING.send_pattern
+
+ def_node_matcher :pending_block?,
+ send_pattern(<<~PATTERN)
+ {
+ #ExampleGroups.skipped
+ #Examples.skipped
+ #Examples.pending
+ }
+ PATTERN
def on_send(node)
return unless pending_block?(node) || skipped?(node)
add_offense(node)