mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Merge branch 'master' into release/0.10
This commit is contained in:
commit
29594eefab
4 changed files with 35 additions and 2 deletions
|
@ -77,7 +77,7 @@ module Spectator::DSL
|
|||
# expect(x).to be_a(Int32 | String)
|
||||
# ```
|
||||
macro be_a(expected)
|
||||
::Spectator::Matchers::TypeMatcher({{expected}}).new
|
||||
::Spectator::Matchers::TypeMatcher.create({{expected}})
|
||||
end
|
||||
|
||||
# Indicates that some value should be of a specified type.
|
||||
|
|
|
@ -4,6 +4,11 @@ module Spectator::Matchers
|
|||
# Matcher that tests a value is of a specified type.
|
||||
# The values are compared with the `Object#is_a?` method.
|
||||
struct TypeMatcher(Expected) < StandardMatcher
|
||||
# Alternate constructor that works with constant types and types from variables.
|
||||
def self.create(type : T.class) forall T
|
||||
TypeMatcher(T).new
|
||||
end
|
||||
|
||||
# Short text about the matcher's purpose.
|
||||
# This explains what condition satisfies the matcher.
|
||||
# The description is used when the one-liner syntax is used.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue