March 27, 2016
6:58 p.m.
2016-03-25 1:34 GMT+01:00 Mariano Martinez Peck <marianopeck@gmail.com>:
Good example where I use viruses is stubbing real objects in Mocketry. I
will announce it soon. You can do this:
rect := 0@0 corner: 2@3 rect stub area willReturn: 1000.
rect area "=> 1000". rect origin "=> 0@0".
OK..I should take a look to the code...but...it looks to me that stub the only thing it does is to create the proxy and then the #become: ??
No. Stub should intercept all self-sends. Classic proxy can't do this. Better example to show self-send stubbing: rect := 0@0 corner: 2@3 rect stub width willReturn: 1000. rect area "=> 3000" (area is width and height multiplication).