To avoid error like yesterday, I must verify that all fields mentioned in the XSD files are really checked via Unit-Tests.
I want to add a datastructure to be able to iterate over all fields and values, eg. both true and false should be present. Will start with oddb_calc.xsd, as it is the simpler case with only one xml file and not many fields. This proved to be quite simple as demonstrated with this snippet
fields = { 'ARTICLES/ARTICLE/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/UNIT' => 'mg' }.each do |field, value|
it "should have correct entries for field #{field}" do
nokogiri = Nokogiri::XML(File.read(@oddb_calc_xml))
expect( nokogiri.search(field, nil, { :value => value}).first.text).to eql value
end
end
Adding a similar test for checking attributes. Done for oddb_calc.xml with commit Checking all elements from XSD in oddb_calc.xml
While adding the tests for oddb_article, I remarked that I don't see any NINCD with value '20' (20 => (LPPV) Limitation) in the produced oddb_article.xml. Pushed commits Bumped version to 2.2.8 and Improved spec tests against all XSD elements
Looking into how to fix the NINCD 20 problem. First had to Refactored extractor_spec to use common_before/after. This was stupid error: used an integer instead of string to lookup whether there is a lppv item or not. Fixed with commit Fixed NINCD for LPPV items.
Pushed commits Prepared for release 2.2.8 and Ensure creating workdir before chdir. Should fix errors on Travis-CI
Removing debug puts from my mondays patch. Running watir tests. The new backtracking elements for the changelogs don't have the expected css-class 'th-pointersteps', therefore my watir tests fail. Will think about it in the next days, but pushed commit -m [https://github.com/ngiger/oddb.org/commit/9dd69d3a38371f9590dbc99a9a397c8b607d6ccc|Fix backtracking for fachinfo]], which should be okay for oddb.org.