Add kind_of aliases for be_a matcher

This commit is contained in:
Michael Miller 2020-01-04 10:08:01 -07:00
parent 2538f3a9a4
commit c3688807d4
1 changed files with 28 additions and 0 deletions

View File

@ -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.
#