lib/rubocop/rspec/language.rb in rubocop-rspec-2.2.0 vs lib/rubocop/rspec/language.rb in rubocop-rspec-2.3.0
- old
+ new
@@ -17,40 +17,50 @@
class << self
attr_accessor :config
end
+ # @!method rspec?(node)
def_node_matcher :rspec?, '{(const {nil? cbase} :RSpec) nil?}'
+ # @!method example_group?(node)
def_node_matcher :example_group?, block_pattern('#ExampleGroups.all')
+ # @!method shared_group?(node)
def_node_matcher :shared_group?, block_pattern('#SharedGroups.all')
+ # @!method spec_group?(node)
def_node_matcher :spec_group?,
block_pattern('{#SharedGroups.all #ExampleGroups.all}')
+ # @!method example_group_with_body?(node)
def_node_matcher :example_group_with_body?, <<-PATTERN
(block #{send_pattern('#ExampleGroups.all')} args !nil?)
PATTERN
+ # @!method example?(node)
def_node_matcher :example?, block_pattern('#Examples.all')
+ # @!method hook?(node)
def_node_matcher :hook?, block_pattern('#Hooks.all')
+ # @!method let?(node)
def_node_matcher :let?, <<-PATTERN
{
#{block_pattern('#Helpers.all')}
(send #rspec? #Helpers.all _ block_pass)
}
PATTERN
+ # @!method include?(node)
def_node_matcher :include?, <<-PATTERN
{
#{send_pattern('#Includes.all')}
#{block_pattern('#Includes.all')}
}
PATTERN
+ # @!method subject?(node)
def_node_matcher :subject?, block_pattern('#Subjects.all')
module ExampleGroups # :nodoc:
class << self
def all(element)