Cleanup example name output

This commit is contained in:
Michael Miller 2021-01-16 11:49:43 -07:00
parent 3527507639
commit d738494fdf
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
2 changed files with 12 additions and 2 deletions

View file

@ -82,6 +82,16 @@ module Spectator
with context yield with context yield
end 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 << "<anonymous>"
end
end
# Exposes information about the example useful for debugging. # Exposes information about the example useful for debugging.
def inspect(io) def inspect(io)
# Full example name. # Full example name.

View file

@ -53,7 +53,7 @@ module Spectator
# Prefix with group's full name if the node belongs to a group. # Prefix with group's full name if the node belongs to a group.
if (group = @group) if (group = @group)
io << group group.to_s(io)
# Add padding between the node names # Add padding between the node names
# only if the names don't appear to be symbolic. # only if the names don't appear to be symbolic.
@ -63,7 +63,7 @@ module Spectator
(name.starts_with?('#') || name.starts_with?('.'))) (name.starts_with?('#') || name.starts_with?('.')))
end end
io << name name.to_s(io)
end end
end end
end end