0

I'm working on a project which already had a lot of specs using WebMock. Now we decided to try to install VCR and a couple of things are happening. I created a test that runs inside a VCR.use_cassette block

Now that test fails if I dont add the block below to the spec_helper.rb, which is expected.

VCR.configure do |config|
  config.cassette_library_dir = "fixtures/vcr_cassettes"
  config.hook_into :webmock
end

But when I do add that block, my spec works but all other specs that used WebMock before fail with the error

VCR::Response initialized with an invalid (non-String) body of class Array

Is there any configuration I'm missing? I tried putting the below block on the RSpec.configure block but that did nothing (I also added the :vcr symbol to the specs that I want to use VCR in

config.around(:each) do |example|
  if example.metadata[:vcr]
    example.run
  else
    VCR.turned_off { example.run }
  end
end
PedroNeves
  • 110
  • 10

0 Answers0