Webmock for your browser
Have you ever wondered what your twitter or facebook client-side javascript code does when the API goes down? Have you thought about handling it gracefully, but couldn't work out how to test it actually works?
Try puffing-billy, a new library for stubbing and mocking requests in rspec+capybara request specs. It's like webmock, but it works on requests made by your browser.
Example:
proxy.stub("https://graph.facebook.com:443/me").and_return(:code => 500)
visit "/my/user/page"
page.should have_content "We're sorry, facebook is unavailable. Please try again later"
Written by Olly Smith
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#