Installazione VCR

Crea il file spec/plugins/vcr_config.rb e aggiungilo al file rails_helper.rb

rails_helper.rb
require 'plugins/vcr-config'

Aggiungere al file spec_helper.rb

spec_helper.rb
require 'webmock/rspec'

Nello stesso file aggiungere il codice sottostante

vcr_config.rb
# frozen_string_literal: true

require 'vcr'

# rubocop:disable Layout/SpaceAroundOperators
VCR.configure do |config|
  config.cassette_library_dir                    = 'spec/vcr/cassettes'
  config.hook_into :webmock
  config.configure_rspec_metadata!
  config.ignore_localhost                        = true
  config.allow_http_connections_when_no_cassette = true
end
# rubocop:enable Layout/SpaceAroundOperators

Last updated

Was this helpful?