senny / sablon

Ruby Document Template Processor based on docx templates and Mail Merge fields.
MIT License
446 stars 128 forks source link

Is comparing files in tests robust? #128

Closed revelutions closed 5 years ago

revelutions commented 5 years ago

When comparing docx files in tests against a baseline, is there a risk that there may be minor changes in the xml node ids or sequence of xml nodes, with different versions/patches of word?

stadelmanma commented 5 years ago

In short yes. Microsoft Word will reindex, rename, and reorganize as it sees fit when opening and saving a document.

However, the idea behind Sablon's doc tests against is that given a specific starting point Sablon will always modify a document in a specific way (i.e. nothing is randomly generated). To avoid undesirable changes we only ever open+save a test template when we need to make edits and we never open+save the test document fixture produced by Sablon from a template.