everydayrails / everydayrails-rspec-2017

Sample source for the 2017 edition of Everyday Rails Testing with RSpec.
http://rspectutorial.com
312 stars 247 forks source link

Chapter 10: Fix VCR example #85

Open ruralocity opened 6 years ago

ruralocity commented 6 years ago

If you attempted to run the tests added in chapter 10 since July 1, 2018, you may have noticed that the example using VCR to record an interaction with an external HTTP service no longer works. The IP geocoding service in use before, freegeoip, has been discontinued, and the geocoder gem now defaults to IPInfo.io. Thanks to @JunichiIto for pointing this out to me in #84

This pull request contains code changes necessary to fix this issue, so you can continue to work through examples in the book. I've provided the steps in two standalone commits:

  1. Update the geocoder gem to the latest version, so it uses IPInfo.io by default, and you don't need to do any extra configuration in the sample app. This applies to chapter 2 in the book, where we first look at the untested application.
  2. Re-record the the VCR cassette for the sample code, then adjust the geocoding-related spec to reflect a difference in the new IP geocoding service's output. Again, this applies to chapter 10.

Please click through the commits for additional commentary and to see what's changed from the current book version to now.