2018-08-31 03:07:14 +00:00
|
|
|
module Spectator
|
2018-11-16 16:48:35 +00:00
|
|
|
# Base class that represents the outcome of running an example.
|
|
|
|
# Sub-classes contain additional information specific to the type of result.
|
2018-09-15 19:25:11 +00:00
|
|
|
abstract class Result
|
2018-11-16 16:48:35 +00:00
|
|
|
# Example that was run that this result is for.
|
2018-08-31 03:07:14 +00:00
|
|
|
getter example : Example
|
2018-11-16 16:48:35 +00:00
|
|
|
|
|
|
|
# Length of time it took to run the example.
|
2018-08-31 04:45:49 +00:00
|
|
|
getter elapsed : Time::Span
|
2018-08-31 03:07:14 +00:00
|
|
|
|
2018-11-16 16:48:35 +00:00
|
|
|
# Indicates that an example was run and it was successful.
|
|
|
|
# NOTE: Examples with warnings count as successful.
|
2018-08-31 03:07:14 +00:00
|
|
|
abstract def passed? : Bool
|
2018-11-16 16:48:35 +00:00
|
|
|
|
|
|
|
# Indicates that an example was run, but it failed.
|
|
|
|
# Errors count as failures.
|
2018-09-15 19:30:07 +00:00
|
|
|
abstract def failed? : Bool
|
2018-11-16 16:48:35 +00:00
|
|
|
|
|
|
|
# Indicates whether an error was encountered while running the example.
|
2018-09-15 19:30:07 +00:00
|
|
|
abstract def errored? : Bool
|
2018-11-16 16:48:35 +00:00
|
|
|
|
|
|
|
# Indicates that an example was marked as pending.
|
2018-09-15 19:30:07 +00:00
|
|
|
abstract def pending? : Bool
|
2018-08-31 03:07:14 +00:00
|
|
|
|
2018-11-16 16:48:35 +00:00
|
|
|
# Constructs the base of the result.
|
|
|
|
# The `example` should refer to the example that was run
|
|
|
|
# and that this result is for.
|
|
|
|
# The `elapsed` argument is the length of time it took to run the example.
|
|
|
|
private def initialize(@example, @elapsed)
|
2018-08-31 03:07:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|