> are mock requests usually only about 33% faster than normal HTTP requests?
It depends. If the HTTP request is made to a super fast API (maybe it does a single constant-time lookup in a key-value datastore and returns the result), then you might not see much speedup. If the HTTP request is made to a slow API, VCR will obviously make a much bigger difference.
When you cite the "33% faster" number, is that the improvement to your total test time from using VCR? Or have you specifically benchmarked the parts of the test suite that make HTTP requests, with and without VCR? A 33% improvement in total test time may actually indicate that the HTTP requests are multiple times faster, if the HTTP requests were only taking up 30% (or whatever) of your test time.
FWIW, FakeWeb is quite a bit faster than WebMock, but if only works with Net::HTTP. I've got some benchmarks [1] if you're interested.
> Is this an issue with VCR or am I incorrectly trying to run a before(:all) block?
The issue is that you can't use the `use_vcr_cassette` macro with an HTTP request in a before(:all) block. All `use_vcr_cassette` does is setup the appropriate before(:each) and after(:each) hooks [2]. RSpec runs the before(:all) hooks before it runs the before(:each) hooks for each example--so when your HTTP request is made in the before(:all) hook, the VCR cassette has not yet been inserted. `use_vcr_cassette` is basically just a convenience macro for the 99% use case. In your case, you can just use `VCR.use_cassette` (VCR's main API) directly in the before(:all) hook:
before(:all) do
VCR.use_cassette("my_cassette", :record => :new_episodes) do
# make http request
end
end
Myron