Last Updated: February 25, 2016
· oesmith

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.


proxy.stub("").and_return(:code => 500)
visit "/my/user/page"
page.should have_content "We're sorry, facebook is unavailable. Please try again later"