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.
|
# The example will be assigned to *group* if it is provided.
|
||||||
# A set of *tags* can be used for filtering and modifying example behavior.
|
# A set of *tags* can be used for filtering and modifying example behavior.
|
||||||
# Note: The tags will not be merged with the parent tags.
|
# Note: The tags will not be merged with the parent tags.
|
||||||
def initialize(name : String? = nil, location : Location? = nil, group : ExampleGroup? = nil,
|
def initialize(name : String? = nil, location : Location? = nil,
|
||||||
tags = Tags.new, &block : self ->)
|
@group : ExampleGroup? = nil, tags = Tags.new, &block : self ->)
|
||||||
super(name, location, tags)
|
super(name, location, tags)
|
||||||
|
|
||||||
@context = NullContext.new
|
@context = NullContext.new
|
||||||
|
@ -85,13 +85,13 @@ module Spectator
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@result = Harness.run do
|
@result = Harness.run do
|
||||||
group?.try(&.call_once_before_all)
|
@group.try(&.call_once_before_all)
|
||||||
if (parent = group?)
|
if (parent = @group)
|
||||||
parent.call_around_each(self) { run_internal }
|
parent.call_around_each(self) { run_internal }
|
||||||
else
|
else
|
||||||
run_internal
|
run_internal
|
||||||
end
|
end
|
||||||
if (parent = group?)
|
if (parent = @group)
|
||||||
parent.call_once_after_all if parent.finished?
|
parent.call_once_after_all if parent.finished?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -144,14 +144,14 @@ module Spectator
|
||||||
name = @name
|
name = @name
|
||||||
|
|
||||||
# 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 (parent = @group)
|
||||||
group.to_s(io)
|
parent.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.
|
||||||
# Skip blank group names (like the root group).
|
# Skip blank group names (like the root group).
|
||||||
io << ' ' unless !group.name? || # ameba:disable Style/NegatedConditionsInUnless
|
io << ' ' unless !parent.name? || # ameba:disable Style/NegatedConditionsInUnless
|
||||||
(group.name?.is_a?(Symbol) && name.is_a?(String) &&
|
(parent.name?.is_a?(Symbol) && name.is_a?(String) &&
|
||||||
(name.starts_with?('#') || name.starts_with?('.')))
|
(name.starts_with?('#') || name.starts_with?('.')))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -124,14 +124,14 @@ module Spectator
|
||||||
name = @name
|
name = @name
|
||||||
|
|
||||||
# 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 (parent = @group)
|
||||||
group.to_s(io)
|
parent.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.
|
||||||
# Skip blank group names (like the root group).
|
# Skip blank group names (like the root group).
|
||||||
io << ' ' unless !group.name? || # ameba:disable Style/NegatedConditionsInUnless
|
io << ' ' unless !parent.name? || # ameba:disable Style/NegatedConditionsInUnless
|
||||||
(group.name?.is_a?(Symbol) && name.is_a?(String) &&
|
(parent.name?.is_a?(Symbol) && name.is_a?(String) &&
|
||||||
(name.starts_with?('#') || name.starts_with?('.')))
|
(name.starts_with?('#') || name.starts_with?('.')))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue