tl;dr You can explicitly return whatever data you want from external API requests using Webmock and stubbing requests.
How do you test a Controlle...
For further actions, you may consider blocking this person and/or reporting abuse
A quick note, often you'll want to return status 200 with a specific body. Since status 200 is
to_return
s default, you can simply writeto_return(body: "something")
.Wow, thanks for the info! The less code you write, the less chance for bugs and errors!
Good advice. On smaller projects I tend to do something similar but on my work production application we use the VCR gem which records one call to a yml (a cassette) and then every time the test runs it uses that yml in place of the api response.