diff --git a/src/spectator/test_wrapper.cr b/src/spectator/test_wrapper.cr index 7bd756f..79d5265 100644 --- a/src/spectator/test_wrapper.cr +++ b/src/spectator/test_wrapper.cr @@ -8,18 +8,19 @@ module Spectator # Used to instantiate tests and run them. struct TestWrapper # Description the user provided for the test. - getter description + def description + @description || @source.to_s + end # Location of the test in source code. getter source # Creates a wrapper for the test. - def initialize(@description : String, @source : Source, @test : ::SpectatorTest, @runner : TestMethod) + def initialize(@description : String?, @source : Source, @test : ::SpectatorTest, @runner : TestMethod) end - # Creates a wrapper for the test. - def initialize(description : Nil, @source : Source, @test : ::SpectatorTest, @runner : TestMethod) - @description = @source.to_s + def description? + !@description.nil? end def run