diff --git a/src/spectator/dsl/matcher_dsl.cr b/src/spectator/dsl/matcher_dsl.cr index ec297b8..0c4cf1a 100644 --- a/src/spectator/dsl/matcher_dsl.cr +++ b/src/spectator/dsl/matcher_dsl.cr @@ -423,7 +423,7 @@ module Spectator::DSL macro method_missing(call) {% if call.name.starts_with?("be_") %} {% method_name = call.name[3..-1] %} # Remove `be_` prefix. - ::Spectator::Matchers::PredicateMatcher.new({{method_name.stringify}}, { {{method_name}}: nil }) + ::Spectator::Matchers::PredicateMatcher(NamedTuple({{method_name}}: Nil)).new({{method_name.stringify}}) {% else %} {% raise "Undefined local variable or method '#{call}'" %} {% end %} diff --git a/src/spectator/matchers/matcher.cr b/src/spectator/matchers/matcher.cr index ae4e4f8..7028fbf 100644 --- a/src/spectator/matchers/matcher.cr +++ b/src/spectator/matchers/matcher.cr @@ -9,7 +9,7 @@ module Spectator::Matchers private getter label : String # Creates the base of the matcher. - private def initialize(@label) + def initialize(@label) end # Determines whether the matcher is satisfied with the value given to it. diff --git a/src/spectator/matchers/predicate_matcher.cr b/src/spectator/matchers/predicate_matcher.cr index 0f0d57e..3332403 100644 --- a/src/spectator/matchers/predicate_matcher.cr +++ b/src/spectator/matchers/predicate_matcher.cr @@ -4,7 +4,7 @@ module Spectator::Matchers # Matcher that tests one or more predicates (methods ending in `?`). # The `ExpectedType` type param should be a `NamedTuple`. # Each key in the tuple is a predicate (without the `?`) to test. - struct PredicateMatcher(ExpectedType) < ValueMatcher(ExpectedType) + struct PredicateMatcher(ExpectedType) < Matcher # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. def match?(partial)