diff --git a/src/spectator/spec/node.cr b/src/spectator/spec/node.cr index 4bbde0c..e77f85e 100644 --- a/src/spectator/spec/node.cr +++ b/src/spectator/spec/node.cr @@ -71,13 +71,20 @@ module Spectator # Add padding between the node names # only if the names don't appear to be symbolic. # Skip blank group names (like the root group). - io << ' ' unless !group.name? || # ameba:disable Style/NegatedConditionsInUnless - (group.name?.is_a?(Symbol) && name.is_a?(String) && - (name.starts_with?('#') || name.starts_with?('.'))) + io << ' ' unless symbolic_name?(group, name) end name.to_s(io) end + + # Checks if the full name and description of the node is symbolic. + # This means that a type or method name was referenced. + # Slightly different formatting is applied for symbolic node names. + private def symbolic_name?(group, name) + !group.name? || + (group.name?.is_a?(Symbol) && name.is_a?(String) && + (name.starts_with?('#') || name.starts_with?('.'))) + end end end end