-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to improve usability for testing? #6
Comments
Two options come to mind:
|
@postmodern I wasn't absolutely clear where the whitespace changes were coming from, does the Nokogiri DOM tree include whitespace nodes by default? (I expected they would be stripped, as in both HMTL and XML they are irrelevant) Regarding option #2, that's absolutely a possibility, I just don't know a lot about rspec, specifically how to present sane error messages when the match fails. |
Nokogiri will parse whitespace as Nokogiri::XML::Text nodes. It might be possible to filter out blank Text nodes. |
The more elegant way would be to tell nokogiri to remove blank nodes using the parse options when you originally parse the xml.
|
Hey, following positive and communicative feedback on the other issue I wanted to pitch an idea.
I've come to nokogiri-diff for testing pages (we have a ICAP proxy that we are trying to test). We need to verify that certain pages have been correctly modified, here's our workflow:
Modify the modified version to meet our spec requirements, and then test it something like this:
The mocks are done with Webmock, and load as one spec with any spec fixture.
The HTML diff method I wrote had to screen out some whitespace differences (no semantic value):
I'm not too happy with the implementation, but it more or less works:- unfortunately this is client work into which I can't afford to invest a lot of time into testing infrastructure (“Just ship it!” ) - but I'd like to get your feedback on whether you can see the gem adding those features?
I noticed as well, probably for the best that text nodes don't register as changes, just the attributes and hierarchy.
The text was updated successfully, but these errors were encountered: