From 8dd8db74b997417bd4f7f1477941aea39649fb99 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 17 Feb 2019 13:15:40 -0700 Subject: [PATCH] Remove predicate methods from Result types --- src/spectator/errored_result.cr | 5 ----- src/spectator/failed_result.cr | 20 -------------------- src/spectator/finished_result.cr | 6 ------ src/spectator/pending_result.cr | 25 ------------------------- src/spectator/result.cr | 14 -------------- src/spectator/successful_result.cr | 20 -------------------- 6 files changed, 90 deletions(-) diff --git a/src/spectator/errored_result.cr b/src/spectator/errored_result.cr index d833666..15db072 100644 --- a/src/spectator/errored_result.cr +++ b/src/spectator/errored_result.cr @@ -6,10 +6,5 @@ module Spectator # This is different from a "failed" result # in that the error was not from a failed expectation. class ErroredResult < FailedResult - # Indicates whether an error was encountered while running the example. - # This will always be true for this type of result. - def errored? - true - end end end diff --git a/src/spectator/failed_result.cr b/src/spectator/failed_result.cr index a2304dd..c26c57e 100644 --- a/src/spectator/failed_result.cr +++ b/src/spectator/failed_result.cr @@ -18,25 +18,5 @@ module Spectator def initialize(example, elapsed, @expectations, @error) super(example, elapsed) end - - # Indicates that an example was run and it was successful. - # NOTE: Examples with warnings count as successful. - # This will always be false for this type of result. - def passed? - false - end - - # Indicates that an example was run, but it failed. - # Errors count as failures. - # This will always be true for this type of result. - def failed? - true - end - - # Indicates whether an error was encountered while running the example. - # This will always be false for this type of result. - def errored? - false - end end end diff --git a/src/spectator/finished_result.cr b/src/spectator/finished_result.cr index 4fdabd6..4e85151 100644 --- a/src/spectator/finished_result.cr +++ b/src/spectator/finished_result.cr @@ -11,11 +11,5 @@ module Spectator def initialize(example, @elapsed) super(example) end - - # Indicates that an example was marked as pending. - # This will always be false for this type of result. - def pending? - false - end end end diff --git a/src/spectator/pending_result.cr b/src/spectator/pending_result.cr index 7e102fe..674a960 100644 --- a/src/spectator/pending_result.cr +++ b/src/spectator/pending_result.cr @@ -5,30 +5,5 @@ 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 - # Indicates that an example was run and it was successful. - # NOTE: Examples with warnings count as successful. - # This will always be false for this type of result. - def passed? - false - end - - # Indicates that an example was run, but it failed. - # Errors count as failures. - # This will always be false for this type of result. - def failed? - false - end - - # Indicates whether an error was encountered while running the example. - # This will always be false for this type of result. - def errored? - false - end - - # Indicates that an example was marked as pending. - # This will always be true for this type of result. - def pending? - true - end end end diff --git a/src/spectator/result.cr b/src/spectator/result.cr index 377c4e6..b2933cd 100644 --- a/src/spectator/result.cr +++ b/src/spectator/result.cr @@ -5,20 +5,6 @@ module Spectator # Example that was run that this result is for. getter example : Example - # Indicates that an example was run and it was successful. - # NOTE: Examples with warnings count as successful. - abstract def passed? : Bool - - # Indicates that an example was run, but it failed. - # Errors count as failures. - abstract def failed? : Bool - - # Indicates whether an error was encountered while running the example. - abstract def errored? : Bool - - # Indicates that an example was marked as pending. - abstract def pending? : Bool - # Constructs the base of the result. # The `example` should refer to the example that was run # and that this result is for. diff --git a/src/spectator/successful_result.cr b/src/spectator/successful_result.cr index b665767..8bae742 100644 --- a/src/spectator/successful_result.cr +++ b/src/spectator/successful_result.cr @@ -14,25 +14,5 @@ module Spectator def initialize(example, elapsed, @expectations) super(example, elapsed) end - - # Indicates that an example was run and it was successful. - # NOTE: Examples with warnings count as successful. - # This will always be true for this type of result. - def passed? - true - end - - # Indicates that an example was run, but it failed. - # Errors count as failures. - # This will always be false for this type of result. - def failed? - false - end - - # Indicates whether an error was encountered while running the example. - # This will always be false for this type of result. - def errored? - false - end end end