I have some Cucumber features which need to interact with the Google Maps Routing API. I'm trying to stub out these interactions using VCR.
I have added a VCR tag to my features like so:
@google_routing_api @javascript
Scenario: Creating a bus
Given I am on the buses page
When I follow "Get Started Now"
And then added my VCR configuration in 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
But when I run my cukes, I am told..
Real HTTP connections are disabled. Unregistered request: GET http://127.0.0.1:54181/__identify__
You have to set VCR to ignore localhost requests. Otherwise, when capybara tries to request any page from your website, VCR will block it.
Add c.ignore_localhost = true
to your VCR config block.
VCR.config do |c|
c.cassette_library_dir = 'features/fixtures/vcr_cassettes'
c.stub_with :fakeweb
c.ignore_localhost = true
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With