Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Testing 使用带有Cucumber via标签的VCR_Testing_Cucumber_Bdd_Vcr - Fatal编程技术网

Testing 使用带有Cucumber via标签的VCR

Testing 使用带有Cucumber via标签的VCR,testing,cucumber,bdd,vcr,Testing,Cucumber,Bdd,Vcr,我有一些Cucumber特性,需要与GoogleMaps路由API交互。我正试图用这个方法剔除这些交互作用 我在我的功能中添加了VCR标签,如下所示: @google_routing_api @javascript Scenario: Creating a bus Given I am on the buses page When I follow "Get Started Now" 然后在features/support/VCR.rb require 'vcr' VCR.confi

我有一些Cucumber特性,需要与GoogleMaps路由API交互。我正试图用这个方法剔除这些交互作用

我在我的功能中添加了VCR标签,如下所示:

@google_routing_api @javascript
Scenario: Creating a bus
  Given I am on the buses page
  When I follow "Get Started Now"
然后在
features/support/VCR.rb

require 'vcr'

VCR.config do |c|
  # INFO: This is relative to the Rails.root
  c.cassette_library_dir = 'features/fixtures/vcr_cassettes'
  c.stub_with :fakeweb
end

# INFO: https://github.com/myronmarston/vcr/wiki/Usage-with-Cucumber
VCR.cucumber_tags do |t|
  t.tag '@google_routing_api'
end
但是当我举杯的时候,有人告诉我

Real HTTP connections are disabled. Unregistered request: GET http://127.0.0.1:54181/__identify__
你必须把录像机调到。否则,当水豚试图从您的网站请求任何页面时,VCR将阻止它

c.ignore\u localhost=true
添加到VCR配置块

VCR.config do |c|
  c.cassette_library_dir = 'features/fixtures/vcr_cassettes'
  c.stub_with :fakeweb
  c.ignore_localhost = true
end
FWIW,问题(和解决方案)与黄瓜无关。它与水豚有着千丝万缕的联系,当你使用javascript驱动程序时,它会引导你的应用程序并向它发出请求。如果将capybara与Test::Unit或RSpec一起使用,您也会遇到同样的问题。