CarrierWave has a nice feature for uploading images from remote locations https://github.com/carrierwaveuploader/carrierwave#uploading-files-from-a-remote-location
I'm using Webmock to stub remote requests, but they don't play nicely together. I guess it's because CarrierWave way of downloading images is quite unique.
The problem is that CarrierWave resolves host and I can't stub it because of that.
I encountered a similar issue, and even VCR did not resolve it. (Actually, VCR revealed some clues about it to me.)
I discovered that Carrierwave uses
Resolv.getaddressesto resolve the domain name of the given URL to IP addresses (both IPv4 and IPv6) and then retrieves the resource using one of the IP addresses. So, let's say you mock the URLhttps://wikipedia.org/path/to.png; it may call eitherhttps://103.102.166.224/path/to.pngorhttps://[01:df2:e500:ed1a::1]/path/to.png(in random, not sure why).My workaround for this is to mock
Resolv.getaddresseswith only a specified IP address and stub requests from the given IP address.