3

We are using VCR to record http requests for our tests in a Rails application. The cassettes are currently committed to source but CircleCI does not seem to use them as CircleCI makes new requests everytime. Tests are passing on local environement. I would like CircleCI to use the cassettes that are saved on our git repo. Is this possible ?

When I execute the tests on the circleCI server the tests pass.

Any guidance or suggestions would be much appreciated!

local env: mac OS Big sur 11.6.1

gemfile.rb

gem 'rspec-rails', '~> 5.0'
gem 'vcr', '~> 6.1'

vcr.rb

VCR.configure do |config|
  config.cassette_library_dir = 'spec/cassettes'
  config.hook_into :webmock
  config.ignore_localhost = true
  config.configure_rspec_metadata!

  config.filter_sensitive_data('<BEARER_TOKEN>') do |interaction|
    auths = interaction.request.headers['Authorization']&.first
    if auths && (match = auths.match(/^Bearer\s+([^,\s]+)/))
      match.captures.first
    end
  end
end
Snake
  • 1,157
  • 1
  • 10
  • 21

0 Answers0