[rspec-users] Rate my code: refactoring from spec

Fernando Perez lists at ruby-forum.com
Thu Apr 16 03:36:36 EDT 2009

> So to recap, I would test this behavior via the Paypal examples,
> because that's where the behavior originates.  I may or may not mock
> the call to order.update_from_paypal depending on how complex it is.
> Does that make sense?

Argh! I had sent you an answer but for some reason my session expired 
and the message didn't go through.

Anyway, thank you Pat for your message, I like to check out your blog to 
fetch some tips on how to spec correctly.

The callback is a good idea, I don't use them often enough.

order.update_from_paypal is a simple method that just sets the order 
state to 'paid' or 'unpaid' depending on the payment status. I use other 
payment gateways so it is paypal agnostic. Now that I test my code I 
tend to write smaller methods.
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list