lib/rubocop/cop/rspec/example_starting_character.rb in gitlab-styles-8.0.0 vs lib/rubocop/cop/rspec/example_starting_character.rb in gitlab-styles-9.0.0
- old
+ new
@@ -50,10 +50,11 @@
class ExampleStartingCharacter < Base
extend RuboCop::Cop::AutoCorrector
MSG = 'Only start words with lowercase alpha with no leading/trailing spaces when describing your tests.'
+ # @!method it_description(node)
def_node_matcher :it_description, <<-PATTERN
(block (send _ :it ${
(str $_)
(dstr (str $_ ) ...)
} ...) ...)
@@ -62,9 +63,10 @@
def on_block(node)
it_description(node) do |description_node, _message|
add_wording_offense(description_node, MSG) if invalid_description?(text(description_node))
end
end
+ alias_method :on_numblock, :on_block
private
def add_wording_offense(node, message)
docstring = docstring(node)