Class: RuboCop::Cop::Sevencop::RSpecExamplesInSameGroup
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sevencop::RSpecExamplesInSameGroup
- Defined in:
- lib/rubocop/cop/sevencop/rspec_examples_in_same_group.rb
Overview
Combine examples in same group in the time-consuming kinds of specs.
Constant Summary collapse
- METHOD_NAMES_FOR_REGULAR_EXAMPLE =
%i[ example it its scenario specify ].to_set.freeze
- METHOD_NAMES_FOR_SHARED_EXAMPLES =
%i[ include_examples it_behaves_like it_should_behave_like ].to_set.freeze
- MSG =
'Combine examples in the same group in the time-consuming kinds of specs.'
- RESTRICT_ON_SEND =
[ *METHOD_NAMES_FOR_REGULAR_EXAMPLE, *METHOD_NAMES_FOR_SHARED_EXAMPLES ].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ void
This method returns an undefined value.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rubocop/cop/sevencop/rspec_examples_in_same_group.rb', line 62 def on_send(node) node = node.block_node || node return unless example?(node) previous_sibling_example = previous_sibling_example_of(node) return unless previous_sibling_example add_offense(node) end |