From c3688807d425f76c8969e86ec34e413a18349017 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 4 Jan 2020 10:08:01 -0700 Subject: [PATCH] Add kind_of aliases for be_a matcher --- src/spectator/dsl/matchers.cr | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/spectator/dsl/matchers.cr b/src/spectator/dsl/matchers.cr index 5d3e2ae..f37ada2 100644 --- a/src/spectator/dsl/matchers.cr +++ b/src/spectator/dsl/matchers.cr @@ -94,6 +94,34 @@ module Spectator be_a({{expected}}) end + # Indicates that some value should be of a specified type. + # The `Object#is_a?` method is used for this check. + # A type name or type union should be used for *expected*. + # This method is identical to `#be_a`, + # and exists just to improve grammar. + # + # Examples: + # ``` + # expect(123).to be_kind_of(Int) + # ``` + macro be_kind_of(expected) + be_a({{expected}}) + end + + # Indicates that some value should be of a specified type. + # The `Object#is_a?` method is used for this check. + # A type name or type union should be used for *expected*. + # This method is identical to `#be_a`, + # and exists just to improve grammar. + # + # Examples: + # ``` + # expect(123).to be_a_kind_of(Int) + # ``` + macro be_a_kind_of(expected) + be_a({{expected}}) + end + # Indicates that some value should respond to a method call. # One or more method names can be provided. #