Closed jnicho02 closed 5 years ago
Thank you for this. I'll take a closer look at VCR and see how we could improve the scraping tests.
Does setting the scrape delay to 0 ever affect the real server or will it always use the VCR cache?
There's no need to add unknownsystem
tags as they're done automatically.
Does setting the scrape delay to 0 ever affect the real server or will it always use the VCR cache?
VCR should only be mocking http calls, so any other settings/delays should work as normal. VCR will use the cache if it is there, otherwise it will call t'interweb and create a file ready for next time.
So when writing test code using this you probably want to leave the delay as the default (10), then use the delay option once you've got the stuff in the cache. But leaving this code as it is (with delay 0) is the right thing to do to speed up the existing tests.
I added a few local authorities and also used VCR during rspec testing. If you haven't previously seen it, it automagically stores the responses from http calls in a yml store so that you can a) have repeatable tests, b) don't repeatedly hammer the source site.
rspec/brighton_spec.rb is still a bit slow, but if you turn off your wifi connection you will see that it gets its info from /vcr_cassettes/for_4_days_of_Brighton_and_Hove.yml