Use harness variable

This commit is contained in:
Michael Miller 2019-11-10 13:49:10 -07:00
parent 6c0693f2a4
commit 96aae8f6d5

View file

@ -47,7 +47,7 @@ module Spectator::Mocks
%args = ::Spectator::Mocks::GenericArguments.create({{args.splat}}) %args = ::Spectator::Mocks::GenericArguments.create({{args.splat}})
%call = ::Spectator::Mocks::GenericMethodCall.new({{name.symbolize}}, %args) %call = ::Spectator::Mocks::GenericMethodCall.new({{name.symbolize}}, %args)
%harness.mocks.record_call(self, %call) %harness.mocks.record_call(self, %call)
if (%stub = ::Spectator::Harness.current.mocks.find_stub(self, %call)) if (%stub = %harness.mocks.find_stub(self, %call))
return %stub.call!(%args, typeof({{original}}({{args.splat}}))) return %stub.call!(%args, typeof({{original}}({{args.splat}})))
end end
end end
@ -59,7 +59,7 @@ module Spectator::Mocks
%args = ::Spectator::Mocks::GenericArguments.create({{args.splat}}) %args = ::Spectator::Mocks::GenericArguments.create({{args.splat}})
%call = ::Spectator::Mocks::GenericMethodCall.new({{name.symbolize}}, %args) %call = ::Spectator::Mocks::GenericMethodCall.new({{name.symbolize}}, %args)
%harness.mocks.record_call(self, %call) %harness.mocks.record_call(self, %call)
if (%stub = ::Spectator::Harness.current.mocks.find_stub(self, %call)) if (%stub = %harness.mocks.find_stub(self, %call))
return %stub.call!(%args, typeof({{original}}({{args.splat}}) { |*%ya| yield *%ya })) return %stub.call!(%args, typeof({{original}}({{args.splat}}) { |*%ya| yield *%ya }))
end end
end end