Login  Register

Re: [Ann] New version of Ghost

Posted by Denis Kudriashov on Mar 27, 2016; 6:30pm
URL: https://forum.world.st/Ann-New-version-of-Ghost-tp4886357p4886852.html


2016-03-25 1:34 GMT+01:00 Mariano Martinez Peck <[hidden email]>:
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).