mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Bit of cleanup around parent/group
This commit is contained in:
parent
d7ba47cc49
commit
ef7fca3f95
2 changed files with 13 additions and 13 deletions
|
@ -57,8 +57,8 @@ module Spectator
|
|||
# The example will be assigned to *group* if it is provided.
|
||||
# A set of *tags* can be used for filtering and modifying example behavior.
|
||||
# Note: The tags will not be merged with the parent tags.
|
||||
def initialize(name : String? = nil, location : Location? = nil, group : ExampleGroup? = nil,
|
||||
tags = Tags.new, &block : self ->)
|
||||
def initialize(name : String? = nil, location : Location? = nil,
|
||||
@group : ExampleGroup? = nil, tags = Tags.new, &block : self ->)
|
||||
super(name, location, tags)
|
||||
|
||||
@context = NullContext.new
|
||||
|
@ -85,13 +85,13 @@ module Spectator
|
|||
|
||||
begin
|
||||
@result = Harness.run do
|
||||
group?.try(&.call_once_before_all)
|
||||
if (parent = group?)
|
||||
@group.try(&.call_once_before_all)
|
||||
if (parent = @group)
|
||||
parent.call_around_each(self) { run_internal }
|
||||
else
|
||||
run_internal
|
||||
end
|
||||
if (parent = group?)
|
||||
if (parent = @group)
|
||||
parent.call_once_after_all if parent.finished?
|
||||
end
|
||||
end
|
||||
|
@ -144,14 +144,14 @@ module Spectator
|
|||
name = @name
|
||||
|
||||
# Prefix with group's full name if the node belongs to a group.
|
||||
if (group = @group)
|
||||
group.to_s(io)
|
||||
if (parent = @group)
|
||||
parent.to_s(io)
|
||||
|
||||
# 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) &&
|
||||
io << ' ' unless !parent.name? || # ameba:disable Style/NegatedConditionsInUnless
|
||||
(parent.name?.is_a?(Symbol) && name.is_a?(String) &&
|
||||
(name.starts_with?('#') || name.starts_with?('.')))
|
||||
end
|
||||
|
||||
|
|
|
@ -124,14 +124,14 @@ module Spectator
|
|||
name = @name
|
||||
|
||||
# Prefix with group's full name if the node belongs to a group.
|
||||
if (group = @group)
|
||||
group.to_s(io)
|
||||
if (parent = @group)
|
||||
parent.to_s(io)
|
||||
|
||||
# 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) &&
|
||||
io << ' ' unless !parent.name? || # ameba:disable Style/NegatedConditionsInUnless
|
||||
(parent.name?.is_a?(Symbol) && name.is_a?(String) &&
|
||||
(name.starts_with?('#') || name.starts_with?('.')))
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue