From 5819e0201e3994a747947663d2a4f80f52267aff Mon Sep 17 00:00:00 2001
From: Michael Miller <icy.arctic.fox@gmail.com>
Date: Sat, 15 Sep 2018 13:25:11 -0600
Subject: [PATCH] Shorten names of result classes

---
 .../{errored_example_result.cr => errored_result.cr}   |  4 ++--
 src/spectator/example.cr                               |  2 +-
 .../{failed_example_result.cr => failed_result.cr}     |  4 ++--
 src/spectator/formatters/default_formatter.cr          | 10 +++++-----
 src/spectator/formatters/formatter.cr                  |  2 +-
 src/spectator/pending_example.cr                       |  2 +-
 .../{pending_example_result.cr => pending_result.cr}   |  4 ++--
 src/spectator/report.cr                                |  4 ++--
 src/spectator/{example_result.cr => result.cr}         |  2 +-
 src/spectator/runnable_example.cr                      |  6 +++---
 src/spectator/runner.cr                                |  5 +----
 src/spectator/successful_example_result.cr             |  9 ---------
 src/spectator/successful_result.cr                     |  9 +++++++++
 13 files changed, 30 insertions(+), 33 deletions(-)
 rename src/spectator/{errored_example_result.cr => errored_result.cr} (54%)
 rename src/spectator/{failed_example_result.cr => failed_result.cr} (72%)
 rename src/spectator/{pending_example_result.cr => pending_result.cr} (68%)
 rename src/spectator/{example_result.cr => result.cr} (85%)
 delete mode 100644 src/spectator/successful_example_result.cr
 create mode 100644 src/spectator/successful_result.cr

diff --git a/src/spectator/errored_example_result.cr b/src/spectator/errored_result.cr
similarity index 54%
rename from src/spectator/errored_example_result.cr
rename to src/spectator/errored_result.cr
index 7eea0f7..8be38f8 100644
--- a/src/spectator/errored_example_result.cr
+++ b/src/spectator/errored_result.cr
@@ -1,7 +1,7 @@
-require "./failed_example_result"
+require "./failed_result"
 
 module Spectator
-  class ErroredExampleResult < FailedExampleResult
+  class ErroredResult < FailedResult
     getter error : Exception
 
     def errored? : Bool
diff --git a/src/spectator/example.cr b/src/spectator/example.cr
index c7038a9..f6a493a 100644
--- a/src/spectator/example.cr
+++ b/src/spectator/example.cr
@@ -6,7 +6,7 @@ module Spectator
     def initialize(@group)
     end
 
-    abstract def run : ExampleResult
+    abstract def run : Result
     abstract def description : String
   end
 end
diff --git a/src/spectator/failed_example_result.cr b/src/spectator/failed_result.cr
similarity index 72%
rename from src/spectator/failed_example_result.cr
rename to src/spectator/failed_result.cr
index b7c3f27..e016320 100644
--- a/src/spectator/failed_example_result.cr
+++ b/src/spectator/failed_result.cr
@@ -1,7 +1,7 @@
-require "./example_result"
+require "./result"
 
 module Spectator
-  class FailedExampleResult < ExampleResult
+  class FailedResult < Result
     getter error : Exception
 
     def passed? : Bool
diff --git a/src/spectator/formatters/default_formatter.cr b/src/spectator/formatters/default_formatter.cr
index 0b82da8..ffdcb5c 100644
--- a/src/spectator/formatters/default_formatter.cr
+++ b/src/spectator/formatters/default_formatter.cr
@@ -14,15 +14,15 @@ module Spectator
       def start_example(example : Example)
       end
 
-      def end_example(result : ExampleResult)
+      def end_example(result : Result)
         print case result
-        when SuccessfulExampleResult
+        when SuccessfulResult
           ".".colorize.green
-        when PendingExampleResult
+        when PendingResult
           "P".colorize.yellow
-        when ErroredExampleResult
+        when ErroredResult
           "E".colorize.magenta
-        when FailedExampleResult
+        when FailedResult
           "F".colorize.red
         end
       end
diff --git a/src/spectator/formatters/formatter.cr b/src/spectator/formatters/formatter.cr
index 25f426e..9f51665 100644
--- a/src/spectator/formatters/formatter.cr
+++ b/src/spectator/formatters/formatter.cr
@@ -4,7 +4,7 @@ module Spectator
       abstract def start_suite
       abstract def end_suite(report : Report)
       abstract def start_example(example : Example)
-      abstract def end_example(result : ExampleResult)
+      abstract def end_example(result : Result)
     end
   end
 end
diff --git a/src/spectator/pending_example.cr b/src/spectator/pending_example.cr
index e8d3f13..72862d6 100644
--- a/src/spectator/pending_example.cr
+++ b/src/spectator/pending_example.cr
@@ -3,7 +3,7 @@ require "./example"
 module Spectator
   abstract class PendingExample < Example
     def run
-      PendingExampleResult.new(self)
+      PendingResult.new(self)
     end
   end
 end
diff --git a/src/spectator/pending_example_result.cr b/src/spectator/pending_result.cr
similarity index 68%
rename from src/spectator/pending_example_result.cr
rename to src/spectator/pending_result.cr
index c5122e0..1c05ebb 100644
--- a/src/spectator/pending_example_result.cr
+++ b/src/spectator/pending_result.cr
@@ -1,7 +1,7 @@
-require "./example_result"
+require "./result"
 
 module Spectator
-  class PendingExampleResult < ExampleResult
+  class PendingResult < Result
     def passed?
       false
     end
diff --git a/src/spectator/report.cr b/src/spectator/report.cr
index 22a5ba7..2fd825a 100644
--- a/src/spectator/report.cr
+++ b/src/spectator/report.cr
@@ -2,9 +2,9 @@ module Spectator
   class Report
     getter runtime : Time::Span
 
-    @results : Array(ExampleResult)
+    @results : Array(Result)
 
-    def initialize(results : Enumerable(ExampleResult), @runtime)
+    def initialize(results : Enumerable(Result), @runtime)
       @results = results.to_a
     end
 
diff --git a/src/spectator/example_result.cr b/src/spectator/result.cr
similarity index 85%
rename from src/spectator/example_result.cr
rename to src/spectator/result.cr
index 854d4ad..23c3b5c 100644
--- a/src/spectator/example_result.cr
+++ b/src/spectator/result.cr
@@ -1,5 +1,5 @@
 module Spectator
-  abstract class ExampleResult
+  abstract class Result
     getter example : Example
     getter elapsed : Time::Span
 
diff --git a/src/spectator/runnable_example.cr b/src/spectator/runnable_example.cr
index 9db50dd..a847283 100644
--- a/src/spectator/runnable_example.cr
+++ b/src/spectator/runnable_example.cr
@@ -36,11 +36,11 @@ module Spectator
     private def translate_result(result)
       case (error = result.error)
       when Nil
-        SuccessfulExampleResult.new(self, result.elapsed)
+        SuccessfulResult.new(self, result.elapsed)
       when ExpectationFailed
-        FailedExampleResult.new(self, result.elapsed, error)
+        FailedResult.new(self, result.elapsed, error)
       else
-        ErroredExampleResult.new(self, result.elapsed, error)
+        ErroredResult.new(self, result.elapsed, error)
       end
     end
 
diff --git a/src/spectator/runner.cr b/src/spectator/runner.cr
index 416b904..ae22e10 100644
--- a/src/spectator/runner.cr
+++ b/src/spectator/runner.cr
@@ -1,6 +1,3 @@
-require "./failed_example_result"
-require "./successful_example_result"
-
 module Spectator
   class Runner
     def initialize(@group : ExampleGroup,
@@ -8,7 +5,7 @@ module Spectator
     end
 
     def run : Nil
-      results = [] of ExampleResult
+      results = [] of Result
       elapsed = Time.measure do
         @formatter.start_suite
         results = @group.all_examples.map do |example|
diff --git a/src/spectator/successful_example_result.cr b/src/spectator/successful_example_result.cr
deleted file mode 100644
index d1c1a0e..0000000
--- a/src/spectator/successful_example_result.cr
+++ /dev/null
@@ -1,9 +0,0 @@
-require "./example_result"
-
-module Spectator
-  class SuccessfulExampleResult < ExampleResult
-    def passed? : Bool
-      true
-    end
-  end
-end
diff --git a/src/spectator/successful_result.cr b/src/spectator/successful_result.cr
new file mode 100644
index 0000000..bde4ea0
--- /dev/null
+++ b/src/spectator/successful_result.cr
@@ -0,0 +1,9 @@
+require "./result"
+
+module Spectator
+  class SuccessfulResult < Result
+    def passed? : Bool
+      true
+    end
+  end
+end