Closed DavidMikeSimon closed 6 years ago
Update: I also added some CORS headers to mocked responses so that non-GET requests to external domains can be mocked
Thanks again for all this ❤️ we are still going to look over the changes (and mostly likely merge them), it's just going to take us a few days.
Closing this PR; we've merged most of the changes in via #29 and released as v0.5.0. Thank you! :heart: 🎉
@hashrocketeer Awesome! Thank you! 😁
(This PR was moved from #17)
So I started out thinking "I really wish I could see which requests were proxied from within my capybara specs", and ended up with this PR, which rewrites large portions of
capybara-webmock
.This is definitely a doozy, but I think I have a good reason behind each change I made:
IO.popen
withPopen3
.Popen3
also happens to let me easily access the PID of the spawned process, which lets me move the pidfile logic out ofProxy
and intoWebmock
, and simplify it a little.Process.kill('HUP', rack_pid)
line would crash if the given PID was no longer running.start
before each example instead of before the whole suite. This is needed to reset the list of proxied requests between each example. It's safely idempotent,start
will not start a new process if it already has one running. Existing code that callsstart
inbefore(:suite)
should also continue working as before.chrome_switches
argument seems to be deprecated. The current way that works for me is to putargs
indesiredCapabilities
. See https://sites.google.com/a/chromium.org/chromedriver/capabilitiesPlease let me know if you are interested in merging any of these changes back into the main branch, and if there's anything I can do to bring this code up to your standards. And, thank you for creating the wonderful and helpful tool
capybara-webmock
. :-)