From 78698d2de9838d9e02a901b42ae765cb91855b06 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 23 Jan 2019 16:43:59 -0700 Subject: [PATCH] Can't support multiple arguments (expected values) The macro would only "attach" `.to` to the last partial. --- src/spectator/dsl/example_dsl.cr | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/spectator/dsl/example_dsl.cr b/src/spectator/dsl/example_dsl.cr index 580cdfa..af3ddb4 100644 --- a/src/spectator/dsl/example_dsl.cr +++ b/src/spectator/dsl/example_dsl.cr @@ -17,12 +17,6 @@ module Spectator::DSL # Where the actual value is returned by the system-under-test, # and the expected value is what the actual value should be to satisfy the condition. # - # Multiple values can be checked, for instance: - # ``` - # expect(actual1, actual2).to eq(expected) - # ``` - # This will verify that both `actual1` and `actual2` equal `expected`. - # # The short, one argument syntax used for passing methods to blocks can be used. # So instead of doing this: # ``` @@ -33,11 +27,8 @@ module Spectator::DSL # expect(&.size).to eq(5) # ``` # The method passed will always be evaluated on `#subject`. - macro expect(*actual) - # Loop over every "actual" to check - this is typically just one item. - {% for item in actual %} - ::Spectator::Expectations::ValueExpectationPartial.new({{item.stringify}}, {{item}}) - {% end %} + macro expect(actual) + ::Spectator::Expectations::ValueExpectationPartial.new({{actual.stringify}}, {{actual}}) end # Starts an expectation on a block of code.