Tutorial by Examples

The following example uses allow and receive to stub a Cart's call to a CreditCardService so that the example doesn't have to wait for a network call or use a credit card number that the processor knows about. class Cart def check_out begin transaction_id = CreditCardService.instance...
The following example uses expect and receive to mock an Order's call to a CreditCardService, so that the test passes only if the call is made without having to actually make it. class Order def cancel CreditCardService.instance.refund transaction_id end end describe Order do des...

Page 1 of 1