From 3facf3af9dbf1caf094ea26f3b5550e48ceec0eb Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 14 Oct 2018 11:50:08 -0600 Subject: [PATCH] Change "description" to "what" for consistency --- src/spectator/dsl/structure_dsl.cr | 14 +++++++------- src/spectator/example.cr | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/spectator/dsl/structure_dsl.cr b/src/spectator/dsl/structure_dsl.cr index 8361c3d..a5d8075 100644 --- a/src/spectator/dsl/structure_dsl.cr +++ b/src/spectator/dsl/structure_dsl.cr @@ -110,10 +110,10 @@ module Spectator::DSL raise NotImplementedError.new("Spectator::DSL#include_examples") end - macro it(description, &block) + macro it(what, &block) _spectator_example_wrapper(Wrapper%example, %run) {{block}} - _spectator_example(Example%example, Wrapper%example, ::Spectator::RunnableExample, {{description}}) do + _spectator_example(Example%example, Wrapper%example, ::Spectator::RunnableExample, {{what}}) do protected def run_instance @instance.%run end @@ -122,10 +122,10 @@ module Spectator::DSL ::Spectator::DSL::Builder.add_example(Example%example) end - macro pending(description, &block) + macro pending(what, &block) _spectator_example_wrapper(Wrapper%example, %run) {{block}} - _spectator_example(Example%example, Wrapper%example, ::Spectator::PendingExample, {{description}}) + _spectator_example(Example%example, Wrapper%example, ::Spectator::PendingExample, {{what}}) ::Spectator::DSL::Builder.add_example(Example%example) end @@ -176,7 +176,7 @@ module Spectator::DSL end end - private macro _spectator_example(example_class_name, wrapper_class_name, base_class, description, &block) + private macro _spectator_example(example_class_name, wrapper_class_name, base_class, what, &block) class {{example_class_name.id}} < {{base_class.id}} def initialize(group : ::Spectator::ExampleGroup, sample_values : ::Spectator::Internals::SampleValues) super @@ -187,8 +187,8 @@ module Spectator::DSL {{block.body}} {% end %} - def description - {{description.is_a?(StringLiteral) ? description : description.stringify}} + def what + {{what.is_a?(StringLiteral) ? what : what.stringify}} end end end diff --git a/src/spectator/example.cr b/src/spectator/example.cr index 83ff1f7..372a165 100644 --- a/src/spectator/example.cr +++ b/src/spectator/example.cr @@ -1,6 +1,6 @@ module Spectator # Base class for all types of examples. - # Concrete types must implement the `#run_inner` and `#description` methods. + # Concrete types must implement the `#run_inner` and `#what` methods. abstract class Example # Indicates whether the example has already been run. getter? finished = false @@ -22,7 +22,7 @@ module Spectator private abstract def run_inner : Result # Message that describes what the example tests. - abstract def description : String + abstract def what : String # Creates the base of the example. # The group should be the example group the example belongs to. @@ -36,7 +36,7 @@ module Spectator def to_s(io) @group.to_s(io) io << ' ' - io << description + io << what end end end