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. # The expectations that were run in the example.
getter expectations : Expectations::ExampleExpectations getter expectations : Expectations::ExampleExpectations
# Length of time it took to run the example.
getter elapsed : Time::Span
# Creates a failed result. # Creates a failed result.
# The `example` should refer to the example that was run # The `example` should refer to the example that was run
# and that this result is for. # and that this result is for.
# The `elapsed` argument is the length of time it took to run the example. # 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 `expectations` references the expectations that were checked in the example.
# The `error` is the exception that was raised to cause the failure. # The `error` is the exception that was raised to cause the failure.
def initialize(example, elapsed, @expectations, @error) def initialize(example, @elapsed, @expectations, @error)
super(example, elapsed) super(example)
end end
# Indicates that an example was run and it was successful. # 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. # 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. # This can happen when the functionality to be tested is not implemented yet.
class PendingResult < Result class PendingResult < Result
# Creates a pending result. # Length of time it took to run the example.
# The `example` should refer to the example that was run def elapsed : Time::Span
# and that this result is for. Time::Span.zero
def initialize(example)
super(example, Time::Span.zero)
end end
# Indicates that an example was run and it was successful. # Indicates that an example was run and it was successful.

View file

@ -6,7 +6,7 @@ module Spectator
getter example : Example getter example : Example
# Length of time it took to run the 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. # Indicates that an example was run and it was successful.
# NOTE: Examples with warnings count as successful. # NOTE: Examples with warnings count as successful.
@ -25,8 +25,7 @@ module Spectator
# Constructs the base of the result. # Constructs the base of the result.
# The `example` should refer to the example that was run # The `example` should refer to the example that was run
# and that this result is for. # and that this result is for.
# The `elapsed` argument is the length of time it took to run the example. def initialize(@example)
private def initialize(@example, @elapsed)
end end
end end
end end

View file

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