Class: RuboCop::Cop::Glib::TestNameParentheses

Inherits:
Base
  • Object
show all
Defined in:
lib/glib/rubocop/cops/test_name_parentheses.rb

Overview

Prevents test method names from containing parentheses which can cause issues with test runners

Examples:

# bad
test 'user creation (with email)' do
end

# good
test 'user creation with email' do
end

Constant Summary collapse

MSG =
"Test name should not contain parentheses because for some reason, this will produce: 'Syntax error: \"(\" unexpected'."

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/glib/rubocop/cops/test_name_parentheses.rb', line 23

def on_send(node)
  test_method?(node) do |test_name|
    if test_name.include?('(') || test_name.include?(')')
      add_offense(node)
    end
  end
end