1

きゅうりでビデオデッキを使っています。「api.stripe.com」へのすべてのリクエストを無視し、処理しないよう VCR に依頼します。リクエストが実際の Stripe API サーバーを通過できるようにします。しかし、それらだけです。残りのリクエストは VCR で処理してほしい。したがって、次の VCR セットアップがあります。

require 'vcr'

VCR.configure do |c|
  c.cassette_library_dir = 'vcr_cassettes'
  c.hook_into :webmock
  c.ignore_localhost = true
  c.default_cassette_options = { :record => :new_episodes }
  c.configure_rspec_metadata!
  c.ignore_hosts 'api.stripe.com'
end

テストを実行すると、他の外部サービスにアクセスしているすべてのテストが失敗します。例えば:

#<VCR::Errors::UnhandledHTTPRequestError: 

================================================================================
An HTTP request has been made that VCR does not know how to handle:
POST https://www.googleapis.com/urlshortener/v1/url?key=<my_key>

There is currently no cassette in use. There are a few ways
you can configure VCR to handle this request:

  * If you're surprised VCR is raising this error
    and want insight about how VCR attempted to handle the request,
    you can use the debug_logger configuration option to log more         
    details [1].
  * If you want VCR to record this request and play it back during 
    future test
    runs, you should wrap your test (or this portion of your test) in   
    a `VCR.use_cassette` block [2].
  * If you only want VCR to handle requests made while a cassette is 
    in use,
    configure `allow_http_connections_when_no_cassette = true`. VCR 
    will
    ignore this request since it is made when there is no cassette     
    [3].
   * If you want VCR to ignore this request (and others like it), you  
     can
     set an `ignore_request` callback [4].

だから、本当に、私はここで何が起こっているのか分かりません。何か助けはありますか?

4

1 に答える 1