Fix arg passing and implement arg matching

This commit is contained in:
Michael Miller 2019-11-03 11:42:31 -07:00
parent 1756670710
commit e6c1a6b2d2
2 changed files with 7 additions and 2 deletions

View file

@ -16,7 +16,7 @@ module Spectator::Mocks
dispatcher.call(*@args, **@opts) dispatcher.call(*@args, **@opts)
end end
def ===(other : Arguments(U, NU)) : Bool forall U, NU def ===(other : GenericArguments(U, NU)) : Bool forall U, NU
return false unless @args === other.args return false unless @args === other.args
return false unless @opts.size === other.opts.size return false unless @opts.size === other.opts.size

View file

@ -13,7 +13,12 @@ module Spectator::Mocks
end end
def and_return(value : T) forall T def and_return(value : T) forall T
ValueMethodStub.new(@name, @source, value) ValueMethodStub.new(@name, @source, value, @args)
end
def with(*args : *T, **opts : **NT) forall T, NT
args = GenericArguments.new(args, opts)
NilMethodStub.new(@name, @source, args)
end end
end end
end end