diff --git a/src/spectator/example_group.cr b/src/spectator/example_group.cr index 5ac2785..d62f7dd 100644 --- a/src/spectator/example_group.cr +++ b/src/spectator/example_group.cr @@ -118,7 +118,7 @@ module Spectator end # Checks whether all examples in the group have been run. - def finished? : Bool + def finished? children.all?(&.finished?) end diff --git a/src/spectator/example_hooks.cr b/src/spectator/example_hooks.cr index 2e87e50..db6eef9 100644 --- a/src/spectator/example_hooks.cr +++ b/src/spectator/example_hooks.cr @@ -52,7 +52,7 @@ module Spectator # in addition to a block passed to this method. # To call the block and all "around-each" hooks, # just invoke `Proc#call` on the returned proc. - def wrap_around_each(&block : ->) + def wrap_around_each(&block : ->) : -> wrapper = block # Must wrap in reverse order, # otherwise hooks will run in the wrong order. diff --git a/src/spectator/pending_example.cr b/src/spectator/pending_example.cr index 897b134..f485ec4 100644 --- a/src/spectator/pending_example.cr +++ b/src/spectator/pending_example.cr @@ -5,7 +5,7 @@ module Spectator # This class will not run example code. abstract class PendingExample < Example # Returns a pending result. - private def run_impl : Result + private def run_impl PendingResult.new(self) end end diff --git a/src/spectator/root_example_group.cr b/src/spectator/root_example_group.cr index 83ee641..f169064 100644 --- a/src/spectator/root_example_group.cr +++ b/src/spectator/root_example_group.cr @@ -5,7 +5,7 @@ module Spectator # The root has no parent. class RootExampleGroup < ExampleGroup # Dummy value - this should never be used. - def what : String + def what "ROOT" end diff --git a/src/spectator/runnable_example.cr b/src/spectator/runnable_example.cr index 6e06eb2..2879cb1 100644 --- a/src/spectator/runnable_example.cr +++ b/src/spectator/runnable_example.cr @@ -8,7 +8,7 @@ module Spectator abstract class RunnableExample < Example # Runs the example, hooks, and captures the result # and translates to a usable result. - def run_impl : Result + def run_impl result = capture_result expectations = Internals::Harness.current.expectations translate_result(result, expectations) @@ -35,7 +35,7 @@ module Spectator # Runs all hooks and the example code. # A captured result is returned. - private def capture_result : ResultCapture + private def capture_result ResultCapture.new.tap do |result| # Get the proc that will call around-each hooks and the example. wrapper = wrap_run_example(result) @@ -57,7 +57,7 @@ module Spectator # Creates a proc that runs the test code # and captures the result. - private def wrap_run_example(result) : -> + private def wrap_run_example(result) # Wrap the method that runs and captures # the test code with the around-each hooks. group.wrap_around_each_hooks do diff --git a/src/spectator/runner.cr b/src/spectator/runner.cr index 21b13ee..49c2a34 100644 --- a/src/spectator/runner.cr +++ b/src/spectator/runner.cr @@ -28,7 +28,7 @@ module Spectator # Runs a single example and returns the result. # The formatter is given the example and result information. - private def run_example(example) : Result + private def run_example(example) @config.formatter.start_example(example) Internals::Harness.run(example).tap do |result| @config.formatter.end_example(result)