From 142011a76304e7ea6f6c2755f49b51dd5ca5dfb8 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Tue, 12 Feb 2019 13:48:51 -0700 Subject: [PATCH] Add a silent formatter --- src/spectator/formatters/silent_formatter.cr | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/spectator/formatters/silent_formatter.cr diff --git a/src/spectator/formatters/silent_formatter.cr b/src/spectator/formatters/silent_formatter.cr new file mode 100644 index 0000000..f6bbf15 --- /dev/null +++ b/src/spectator/formatters/silent_formatter.cr @@ -0,0 +1,27 @@ +module Spectator::Formatters + # Formatter that outputs nothing. + # Useful for testing and larger automated processes. + class SilentFormatter < Formatter + # Called when a test suite is starting to execute. + def start_suite(suite : TestSuite) + # ... crickets ... + end + + # Called when a test suite finishes. + # The results from the entire suite are provided. + def end_suite(report : Report) + # ... crickets ... + end + + # Called before a test starts. + def start_example(example : Example) + # ... crickets ... + end + + # Called when a test finishes. + # The result of the test is provided. + def end_example(result : Result) + # ... crickets ... + end + end +end