Fix idiosyncrasies around class method stubs

The new method misbehaves here.
It always appeared as defined, even though it isn't explicitly defined 
in the class.
This commit is contained in:
Michael Miller 2020-02-14 18:14:32 -07:00
parent 7a8e570bea
commit 2aba67edae

View file

@ -34,16 +34,19 @@ module Spectator::Mocks
raise "Unrecognized stub format"
end
original = if @type.methods.find { |m| m.name.id == name }
:previous_def
else
:super
end.id
t = @type
receiver = if receiver == :self.id
t = t.class
"self."
else
""
end.id
original = if (name == :new.id && receiver == "self.".id) ||
(t.superclass.has_method?(name) && !t.overrides?(t.superclass, name))
:super
else
:previous_def
end.id
%}
{% if body && !body.is_a?(Nop) %}