Remove shared elapsed time

Since PendingResult always returns zero, it's not necessary to store it.
This commit is contained in:
Michael Miller 2018-12-10 11:16:43 -07:00
parent 56e8f8978b
commit 9e004324c9
4 changed files with 15 additions and 12 deletions

View file

@ -9,14 +9,17 @@ module Spectator
# The expectations that were run in the example.
getter expectations : Expectations::ExampleExpectations
# Length of time it took to run the example.
getter elapsed : Time::Span
# Creates a failed 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.
# The `expectations` references the expectations that were checked in the example.
# The `error` is the exception that was raised to cause the failure.
def initialize(example, elapsed, @expectations, @error)
super(example, elapsed)
def initialize(example, @elapsed, @expectations, @error)
super(example)
end
# Indicates that an example was run and it was successful.

View file

@ -5,11 +5,9 @@ module Spectator
# A pending result means the example is not ready to run yet.
# This can happen when the functionality to be tested is not implemented yet.
class PendingResult < Result
# Creates a pending result.
# The `example` should refer to the example that was run
# and that this result is for.
def initialize(example)
super(example, Time::Span.zero)
# Length of time it took to run the example.
def elapsed : Time::Span
Time::Span.zero
end
# Indicates that an example was run and it was successful.

View file

@ -6,7 +6,7 @@ module Spectator
getter example : Example
# Length of time it took to run the example.
getter elapsed : Time::Span
abstract def elapsed : Time::Span
# Indicates that an example was run and it was successful.
# NOTE: Examples with warnings count as successful.
@ -25,8 +25,7 @@ module Spectator
# 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)
def initialize(@example)
end
end
end

View file

@ -6,13 +6,16 @@ module Spectator
# The expectations that were run in the example.
getter expectations : Expectations::ExampleExpectations
# Length of time it took to run the example.
getter elapsed : Time::Span
# Creates a successful 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.
# The `expectations` references the expectations that were checked in the example.
def initialize(example, elapsed, @expectations)
super(example, elapsed)
def initialize(example, @elapsed, @expectations)
super(example)
end
# Indicates that an example was run and it was successful.