diff --git a/src/spectator/dsl/examples.cr b/src/spectator/dsl/examples.cr index 399494f..21bf257 100644 --- a/src/spectator/dsl/examples.cr +++ b/src/spectator/dsl/examples.cr @@ -68,7 +68,8 @@ module Spectator::DSL ::Spectator::DSL::Builder.add_pending_example( _spectator_example_name(\{{what}}), ::Spectator::Location.new(\{{what.filename}}, \{{what.line_number}}), - \%tags + \%tags, + "Not yet implemented" ) \{% end %} end @@ -110,7 +111,8 @@ module Spectator::DSL ::Spectator::DSL::Builder.add_pending_example( _spectator_example_name(\{{what}}), ::Spectator::Location.new(\{{(what || block).filename}}, \{{(what || block).line_number}}, \{{(what || block).end_line_number}}), - \%tags + \%tags, + "Not yet implemented" ) end end diff --git a/src/spectator/example.cr b/src/spectator/example.cr index c1757d6..651aee7 100644 --- a/src/spectator/example.cr +++ b/src/spectator/example.cr @@ -74,8 +74,9 @@ module Spectator # A set of *tags* can be used for filtering and modifying example behavior. # Note: The tags will not be merged with the parent tags. def self.pending(name : String? = nil, location : Location? = nil, - group : ExampleGroup? = nil, tags = Tags.new) - tags = tags.merge({:pending => nil}) { |_, v, _| v } # Add pending tag if it doesn't exist. + group : ExampleGroup? = nil, tags = Tags.new, reason = nil) + # Add pending tag and reason if they don't exist. + tags = tags.merge({:pending => nil, :reason => reason}) { |_, v, _| v } new(name, location, group, tags) { nil } end diff --git a/src/spectator/spec/builder.cr b/src/spectator/spec/builder.cr index 090de03..ca938c2 100644 --- a/src/spectator/spec/builder.cr +++ b/src/spectator/spec/builder.cr @@ -116,11 +116,12 @@ module Spectator # # A set of *tags* can be used for filtering and modifying example behavior. # For instance, adding a "pending" tag will mark the test as pending and skip execution. + # A default *reason* can be given in case the user didn't provide one. # # The newly created example is returned. - def add_pending_example(name, location, tags = Tags.new) : Example + def add_pending_example(name, location, tags = Tags.new, reason = nil) : Example Log.trace { "Add pending example: #{name} @ #{location}; tags: #{tags}" } - Example.pending(name, location, current_group, tags) + Example.pending(name, location, current_group, tags, reason) # The example is added to the current group by `Example` initializer. end