Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
This needs tests but can I get your opinion? Optionally autolaunch a visual diff tool for comparing registered stubs #137
I found myself debugging some XML for an external service and found it very difficult doing a spot-the-difference on a huge wall of text.
This will popup opendiff against all the registered stubs and the attempted request.
Very cool idea with using the diff tool to spot the differences. It can be very useful in some circumstances.
I'm not sure webmock should depend on any external tools, but I can see you made it configurable, so it's an option.
Maybe it would be better to declare a need to use diff tool as webmock configuration. I.e WebMock.use_diff_tool or something.
I'm not sure the diff tool should be initialized within exception constructor. I would rather imagine that the exception is
If I have 5 stubs declared, it is going to open 5 windows at once, right? Did you test it with just one registered stub or many?
Thanks for your comments.
I.e. in my case only fire up for "application/xml"
It's a pain as it actually opens up windows which block the thread at the moment, so I'd like to tackle that issue too.
My first attempt was trying to parse and diff the xml tree but this approach is more pragmatic.
I'll take a look at your points and incorporate them and get back to you with an updated pull request.
I should imagine it being as useful for json.
Another approach which would be less intrusive (but more work), would be to do some nice diffing and colouring in the terminal output.
Another improvement to the output would be optional Ruby 1.9 hash syntax in the example stubs.