diff --git a/src/spectator/example.cr b/src/spectator/example.cr index a90931e..5ff9750 100644 --- a/src/spectator/example.cr +++ b/src/spectator/example.cr @@ -82,6 +82,16 @@ module Spectator with context yield end + # Constructs the full name or description of the example. + # This prepends names of groups this example is part of. + def to_s(io) + if name? + super + else + io << "" + end + end + # Exposes information about the example useful for debugging. def inspect(io) # Full example name. diff --git a/src/spectator/spec_node.cr b/src/spectator/spec_node.cr index a559938..7a00173 100644 --- a/src/spectator/spec_node.cr +++ b/src/spectator/spec_node.cr @@ -53,7 +53,7 @@ module Spectator # Prefix with group's full name if the node belongs to a group. if (group = @group) - io << group + group.to_s(io) # Add padding between the node names # only if the names don't appear to be symbolic. @@ -63,7 +63,7 @@ module Spectator (name.starts_with?('#') || name.starts_with?('.'))) end - io << name + name.to_s(io) end end end