Class: RuboCop::EightyFourCodes::ExampleGroup
- Defined in:
- lib/rubocop/eightyfourcodes/example_group.rb
Overview
Wrapper for RSpec example groups
Constant Summary
Constants included from Language
Instance Method Summary collapse
- #examples ⇒ Object
-
#hook(node) ⇒ Object
Detect if node is ‘before`, `after`, `around`.
- #hooks ⇒ Object
-
#scope_change?(node) ⇒ Object
Detect if the node is an example group or shared example.
- #subjects ⇒ Object
Methods inherited from Concept
#eql?, #hash, #initialize, #to_node
Constructor Details
This class inherits a constructor from RuboCop::EightyFourCodes::Concept
Instance Method Details
#examples ⇒ Object
29 30 31 |
# File 'lib/rubocop/eightyfourcodes/example_group.rb', line 29 def examples examples_in_scope(node).map(&Example.public_method(:new)) end |
#hook(node) ⇒ Object
Detect if node is ‘before`, `after`, `around`
19 20 21 |
# File 'lib/rubocop/eightyfourcodes/example_group.rb', line 19 def_node_matcher :hook, <<-PATTERN (block {$(send nil #{Hooks::ALL.node_pattern_union} ...)} ...) PATTERN |
#hooks ⇒ Object
33 34 35 |
# File 'lib/rubocop/eightyfourcodes/example_group.rb', line 33 def hooks hooks_in_scope(node).map(&Hook.public_method(:new)) end |
#scope_change?(node) ⇒ Object
Detect if the node is an example group or shared example
Selectors which indicate that we should stop searching
13 14 |
# File 'lib/rubocop/eightyfourcodes/example_group.rb', line 13 def_node_matcher :scope_change?, (ExampleGroups::ALL + SharedGroups::ALL).block_pattern |
#subjects ⇒ Object
25 26 27 |
# File 'lib/rubocop/eightyfourcodes/example_group.rb', line 25 def subjects subjects_in_scope(node) end |