Add require statements and namespace Value

When defining a matcher outside of the `Spectator` module (custom matcher), `Value(ExpectedType)` can't be resolved.
I suspect this is a Crystal compiler bug, since a derived class should not affect lookups of parent classes like this.
Require statements are added to (hopefully) ensure `Spectator::Value` is defined for the initializer.
Related to https://github.com/icy-arctic-fox/spectator/issues/46
This commit is contained in:
Michael Miller 2022-09-03 16:35:38 -06:00
parent 7549351cce
commit ccdf9f124b
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF

View file

@ -1,3 +1,5 @@
require "../expression"
require "../value"
require "./standard_matcher"
module Spectator::Matchers
@ -22,7 +24,7 @@ module Spectator::Matchers
# Creates the value matcher.
# The expected value is stored for later use.
def initialize(@expected : Value(ExpectedType))
def initialize(@expected : ::Spectator::Value(ExpectedType))
end
# Additional information about the match failure.