Class: RuboCop::Cop::RSpec::UndescriptiveLiteralsDescription
- Defined in:
- lib/rubocop/cop/rspec/undescriptive_literals_description.rb
Overview
Description should be descriptive.
If example group or example contains only ‘execute string`, numbers and regular expressions, the description is not clear.
Constant Summary collapse
- MSG =
'Description should be descriptive.'
Instance Method Summary collapse
- #example_groups_or_example?(node) ⇒ Object
-
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler.
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#example_groups_or_example?(node) ⇒ Object
51 52 53 |
# File 'lib/rubocop/cop/rspec/undescriptive_literals_description.rb', line 51 def_node_matcher :example_groups_or_example?, <<~PATTERN (block (send #rspec? {#ExampleGroups.all #Examples.all} $_) ...) PATTERN |
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler
55 56 57 58 59 |
# File 'lib/rubocop/cop/rspec/undescriptive_literals_description.rb', line 55 def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler example_groups_or_example?(node) do |arg| add_offense(arg) if offense?(arg) end end |