mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Slightly better wording and naming
This commit is contained in:
parent
36071fcdbf
commit
c48467f783
3 changed files with 7 additions and 7 deletions
|
@ -17,11 +17,11 @@ module Spectator
|
||||||
def run : Result
|
def run : Result
|
||||||
raise "Attempted to run example more than once (#{self})" if finished?
|
raise "Attempted to run example more than once (#{self})" if finished?
|
||||||
@finished = true
|
@finished = true
|
||||||
run_inner
|
run_impl
|
||||||
end
|
end
|
||||||
|
|
||||||
# Implementation-specific for running the example code.
|
# Implementation-specific for running the example code.
|
||||||
private abstract def run_inner : Result
|
private abstract def run_impl : Result
|
||||||
|
|
||||||
# Creates the base of the example.
|
# Creates the base of the example.
|
||||||
# The group should be the example group the example belongs to.
|
# The group should be the example group the example belongs to.
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Spectator
|
||||||
# This class will not run example code.
|
# This class will not run example code.
|
||||||
abstract class PendingExample < Example
|
abstract class PendingExample < Example
|
||||||
# Returns a pending result.
|
# Returns a pending result.
|
||||||
private def run_inner : Result
|
private def run_impl : Result
|
||||||
PendingResult.new(self)
|
PendingResult.new(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Spectator
|
||||||
abstract class RunnableExample < Example
|
abstract class RunnableExample < Example
|
||||||
# Runs the example, hooks, and captures the result
|
# Runs the example, hooks, and captures the result
|
||||||
# and translates to a usable result.
|
# and translates to a usable result.
|
||||||
def run_inner : Result
|
def run_impl : Result
|
||||||
result = capture_result
|
result = capture_result
|
||||||
expectations = Internals::Harness.current.expectation_results
|
expectations = Internals::Harness.current.expectation_results
|
||||||
translate_result(result, expectations)
|
translate_result(result, expectations)
|
||||||
|
@ -41,7 +41,7 @@ module Spectator
|
||||||
private def capture_result : ResultCapture
|
private def capture_result : ResultCapture
|
||||||
ResultCapture.new.tap do |result|
|
ResultCapture.new.tap do |result|
|
||||||
# Get the proc that will call around-each hooks and the example.
|
# Get the proc that will call around-each hooks and the example.
|
||||||
wrapper = wrapped_run_example(result)
|
wrapper = wrap_run_example(result)
|
||||||
begin
|
begin
|
||||||
run_before_hooks
|
run_before_hooks
|
||||||
wrapper.call
|
wrapper.call
|
||||||
|
@ -53,7 +53,7 @@ module Spectator
|
||||||
|
|
||||||
# Creates a proc that runs the test code
|
# Creates a proc that runs the test code
|
||||||
# and captures the result.
|
# and captures the result.
|
||||||
private def wrapped_run_example(result) : ->
|
private def wrap_run_example(result) : ->
|
||||||
# Wrap the method that runs and captures
|
# Wrap the method that runs and captures
|
||||||
# the test code with the around-each hooks.
|
# the test code with the around-each hooks.
|
||||||
group.wrap_around_each_hooks do
|
group.wrap_around_each_hooks do
|
||||||
|
@ -67,7 +67,7 @@ module Spectator
|
||||||
# Capture how long it takes to run the test code.
|
# Capture how long it takes to run the test code.
|
||||||
result.elapsed = Time.measure do
|
result.elapsed = Time.measure do
|
||||||
begin
|
begin
|
||||||
# Actually go run the example code.
|
# Actually run the example code.
|
||||||
run_instance
|
run_instance
|
||||||
rescue ex # Catch all errors and handle them later.
|
rescue ex # Catch all errors and handle them later.
|
||||||
result.error = ex
|
result.error = ex
|
||||||
|
|
Loading…
Reference in a new issue