I neet VCR to skip just https://api.github.com/users/lapaty/starred calling the real external API, while going on mocking similar path like https://api.github.com/repos/lgs/elasticrepo
Until now I tried the followings, without any success :
VCR.configure do |c|
...
c.ignore_hosts 'api.github.com/users/lapaty/starred'
end
and
VCR.configure do |c|
...
c.ignore_request do |request|
URI(request.uri).uri == 'https://api.github.com/users/lapaty/starred'
end
end
c.ignore_hosts 'api.github.com/users/lapaty/starred'
will never work, as api.github.com/users/lapaty/starred
is not a host.
For the second thing you tried, the URI(request.uri).uri
part is unnecessary -- you're parsing the string as a uri, then getting the string representation out of that (which should give you just request.uri
). I think this should work:
VCR.configure do |c|
c.ignore_request do |request|
request.uri == 'https://api.github.com/users/lapaty/starred'
end
end
If it's not working, then it suggests that the URI string is not exactly "https://api.github.com/users/lapaty/starred"
like you think it is. You can add some puts
logging in the ignore_request
block to see what requests are being made, or you can use the debug_logger option to get detailed insight into exactly what VCR is doing and why.