Additional methods to describe result

This commit is contained in:
Michael Miller 2018-09-15 13:30:07 -06:00
parent 5819e0201e
commit ac53394b8d
5 changed files with 42 additions and 3 deletions

View file

@ -4,7 +4,7 @@ module Spectator
class ErroredResult < FailedResult
getter error : Exception
def errored? : Bool
def errored?
true
end
end

View file

@ -4,7 +4,19 @@ module Spectator
class FailedResult < Result
getter error : Exception
def passed? : Bool
def passed?
false
end
def failed?
true
end
def errored?
false
end
def pending?
false
end

View file

@ -6,6 +6,18 @@ module Spectator
false
end
def failed?
false
end
def errored?
false
end
def pending?
true
end
def initialize(@example)
super(@example, Time::Span.new(nanoseconds: 0))
end

View file

@ -4,6 +4,9 @@ module Spectator
getter elapsed : Time::Span
abstract def passed? : Bool
abstract def failed? : Bool
abstract def errored? : Bool
abstract def pending? : Bool
protected def initialize(@example, @elapsed)
end

View file

@ -2,8 +2,20 @@ require "./result"
module Spectator
class SuccessfulResult < Result
def passed? : Bool
def passed?
true
end
def failed?
false
end
def errored?
false
end
def pending?
false
end
end
end