VCR not recording cassettes
ruby, vcr
Solution
The problem is that you are using `Typhoeus` as your HTTP client, but hooking into `FakeWeb`, which only provides support for `Net::HTTP`. VCR can hook directly into Typhoeus (since it provides good public APIs for doing so) if you configure it:
VCR.configure do |vcr|
vcr.hook_into :typhoeus
end
The `hook_into` docs list all the options and which hooks work with which HTTP clients. If you have any suggestions for improving the documentation to prevent others from having this confusion, please let me know.
Problem
I have a very simple `module` I'm testing with Ruby using the VCR gem. I've configured VCR according to the documentation but cannot seem to get a cassette to record in the cassette directory. I've even changed the permissions on the cassette directory to 777 just in case. The really strange thing is, I've completely removed the cassette directory, run the specs, and then a new cassette directory is created. I'm using `Typhoeus` 0.4.2 with `Hydra`. I can't upgrade Typhoeus at the moment. The relevant code: ``` require 'rspec' require 'vcr' require_relative File.join("..", "crawl_handler") VCR.configure do |c| c.cassette_library_dir = "spec/vcr_cassettes" c.hook_into :fakeweb c.allow_http_connections_when_no_cassette = false end ... # => other describe statements describe "#handle_http_response" do before(:each) do get_some_response = lambda { # NOTE: typhoeus v. 0.5 is MUCH less setup :) VCR.use_cassette("bme") do request = Typhoeus::Request.new("www.bing.com") hydra = Typhoeus::Hydra.new hydra.queue(request) hydra.run response = request.response end } @message = @subject.handle_http_response("www.bing.com", get_some_response.call) end it "returns a message hash" do @message.should be_kind_of Hash end ... ``` I have no idea why cassettes aren't being written.