Include stub source in to_s

This commit is contained in:
Michael Miller 2019-11-03 13:13:54 -07:00
parent 59884f253f
commit b107511c9e
4 changed files with 7 additions and 3 deletions

View file

@ -20,6 +20,10 @@ module Spectator::Mocks
io << @args io << @args
io << ')' io << ')'
end end
io << " : "
io << ReturnType
io << " at "
io << @source
end end
end end
end end

View file

@ -8,7 +8,7 @@ module Spectator::Mocks
if (cast = nil.as?(RT)) if (cast = nil.as?(RT))
cast cast
else else
raise "The return type of stub #{to_s} : Nil doesn't match the expected type #{RT}" raise "The return type of stub #{self} doesn't match the expected type #{RT}"
end end
end end

View file

@ -12,7 +12,7 @@ module Spectator::Mocks
if (cast = result.as?(RT)) if (cast = result.as?(RT))
cast cast
else else
raise "The return type of stub #{to_s} : #{ReturnType} doesn't match the expected type #{RT}" raise "The return type of stub #{self} doesn't match the expected type #{RT}"
end end
end end
end end

View file

@ -12,7 +12,7 @@ module Spectator::Mocks
if (cast = result.as?(RT)) if (cast = result.as?(RT))
cast cast
else else
raise "The return type of stub #{to_s} : #{ReturnType} doesn't match the expected type #{RT}" raise "The return type of stub #{self} doesn't match the expected type #{RT}"
end end
end end
end end