I have a very simple controller that grabs some data from rss using Feedjira. I want to test this controller by recording the RSS response. Here is the controller code:
def index @news = Feedjira::Feed.fetch_and_parse URI.encode("http://news.google.com/news/feeds?q=\"#{query}\"&output=rss") end
and my spec test:
it "should assign news feed", :vcr do get :index assigns(:news).entries.size.should == 6 assigns(:news).entries[0].title.should == "First item title"end
and code for vcd config:
VCR.configure do |c| c.cassette_library_dir = Rails.root.join("spec", "vcr") c.hook_into :fakeweb c.ignore_localhost = trueendRSpec.configure do |c| c.treat_symbols_as_metadata_keys_with_true_values = true c.around(:each, :vcr) do |example| name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_") options = example.metadata.slice(:record, :match_requests_on).except(:example_group) VCR.use_cassette(name, options) { example.call } endend
For some unknown reason, the VCR cassete is not being recorded in this specific test. All other tests that use web calls are working, but with this one with Feedjira it seems that vcr does not detects the network calls. Why?