Move the expectations attribute up to FinishedResult

This commit is contained in:
Michael Miller 2019-02-17 23:03:43 -07:00
parent 847cc662bd
commit eaf1d19feb
3 changed files with 7 additions and 18 deletions

View file

@ -6,17 +6,14 @@ module Spectator
# Error that occurred while running the example.
getter error : Exception
# The expectations that were run in the example.
getter expectations : Expectations::ExampleExpectations
# 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, elapsed, expectations)
end
# Calls the `failure` method on *interface* and passes self.

View file

@ -4,11 +4,15 @@ module Spectator
# Length of time it took to run the example.
getter elapsed : Time::Span
# The expectations that were run in the example.
getter expectations : Expectations::ExampleExpectations
# 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.
def initialize(example, @elapsed)
# The *expectations* references the expectations that were checked in the example.
def initialize(example, @elapsed, @expectations)
super(example)
end
end

View file

@ -3,18 +3,6 @@ require "./finished_result"
module Spectator
# Outcome that indicates running an example was successful.
class SuccessfulResult < FinishedResult
# The expectations that were run in the example.
getter expectations : Expectations::ExampleExpectations
# 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)
end
# Calls the `success` method on *interface* and passes self.
def call(interface)
interface.success(self)