mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Short-hand syntax for blocks with yield
This commit is contained in:
parent
d670d96045
commit
4948fe0c6f
3 changed files with 7 additions and 7 deletions
|
@ -17,11 +17,11 @@ module Spectator
|
|||
end
|
||||
|
||||
def examples : Enumerable(Example)
|
||||
children.compact_map { |child| child.as?(Example) }
|
||||
children.compact_map &.as?(Example)
|
||||
end
|
||||
|
||||
def groups : Enumerable(ExampleGroup)
|
||||
children.compact_map { |child| child.as?(ExampleGroup) }
|
||||
children.compact_map &.as?(ExampleGroup)
|
||||
end
|
||||
|
||||
def example_count
|
||||
|
|
|
@ -20,19 +20,19 @@ module Spectator
|
|||
end
|
||||
|
||||
def run_before_all
|
||||
@before_all.each(&.call)
|
||||
@before_all.each &.call
|
||||
end
|
||||
|
||||
def run_before_each
|
||||
@before_each.each(&.call)
|
||||
@before_each.each &.call
|
||||
end
|
||||
|
||||
def run_after_all
|
||||
@after_all.each(&.call)
|
||||
@after_all.each &.call
|
||||
end
|
||||
|
||||
def run_after_each
|
||||
@after_each.each(&.call)
|
||||
@after_each.each &.call
|
||||
end
|
||||
|
||||
def wrap_around_each(&block : ->)
|
||||
|
|
|
@ -37,7 +37,7 @@ module Spectator
|
|||
end
|
||||
|
||||
def example_runtime
|
||||
@results.map { |result| result.elapsed }.sum
|
||||
@results.map(&.elapsed).sum
|
||||
end
|
||||
|
||||
def overhead_time
|
||||
|
|
Loading…
Reference in a new issue