[rspec-users] BDD and Interacting With External Resources

Shea Levy shea at shealevy.com
Wed Dec 29 01:01:12 EST 2010



Hi all, 

What's the best way to handle features which rely on an
external API in a behaviour-driven way? Suppose I have an app which manages
online ordering from several independent stores, with a cut taken from each
purchase, and I want to add a feature whereby orders made by phone that
were facilitated by the website can be tracked so that the cut can be
taken. I discover that I can use Twilio to generate a phone number for each
store and set up a controller to generate Twiml that results in callers to
that phone number hearing a recording warning them that their call will be
recorded then redirecting them to the store's real number, with a URL of
the recording being sent back to the controller after hangup. How would I
drive out the desired behaviour (which can be seen as either "the app
generates the proper twiml and stores the relevant call data" or "the app
routes and records calls" depending on your perspective) from the
outside-in? I don't know how to write a Cucumber step definition that
ensures that a phone rings! 

Cheers,
 Shea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101228/d3d21b1c/attachment.html>


More information about the rspec-users mailing list