Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created June 28, 2014 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcoyne/be7ab1648533abc8dbd0 to your computer and use it in GitHub Desktop.
Save jcoyne/be7ab1648533abc8dbd0 to your computer and use it in GitHub Desktop.
1) MetadataXmlParser::get_record_class returns a class
Failure/Error: record_class = MetadataXmlParser.get_record_class(build_node)
HasModelNodeInvalidError:
Invalid data in <rel:hasModel> for record beginning at line 5 (file: anatomicaltables00ches.pdf, pid: tufts:1)
# ./lib/import_export/metadata_xml_parser.rb:199:in `get_record_class'
# ./spec/lib/import_export/metadata_xml_parser_spec.rb:203:in `block (3 levels) in <top (required)>'
2) MetadataXmlParser::build_record builds a record that has the given filename
Failure/Error: m = MetadataXmlParser.build_record(build_node(attributes).to_xml, attributes['file'].first)
HasModelNodeInvalidError:
Invalid data in <rel:hasModel> for record beginning at line 1 (file: somefile.pdf, pid: tufts:1)
# ./lib/import_export/metadata_xml_parser.rb:199:in `get_record_class'
# ./lib/import_export/metadata_xml_parser.rb:118:in `build_record'
# ./spec/lib/import_export/metadata_xml_parser_spec.rb:59:in `block (3 levels) in <top (required)>'
3) MetadataXmlParser::validate finds ActiveFedora errors for each record
Failure/Error: expect(errors.sort.first).to match("Displays can't be blank for record beginning at line 1.*")
expected "Invalid data in <rel:hasModel> for record beginning at line 1 (file: anatomicaltables00ches.pdf, pid: tufts:1)" to match "Displays can't be blank for record beginning at line 1.*"
# ./spec/lib/import_export/metadata_xml_parser_spec.rb:13:in `block (3 levels) in <top (required)>'
4) MetadataXmlParser::validate returns an empty array when there are no errors
Failure/Error: expect(MetadataXmlParser.validate(build_node.to_xml)).to eq []
expected: []
got: [#<HasModelNodeInvalidError: Invalid data in <rel:hasModel> for record beginning at line 1 (file: anatomicaltables00ches.pdf, pid: tufts:1)>]
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-[]
+[#<HasModelNodeInvalidError: Invalid data in <rel:hasModel> for record beginning at line 1 (file: anatomicaltables00ches.pdf, pid: tufts:1)>]
# ./spec/lib/import_export/metadata_xml_parser_spec.rb:7:in `block (3 levels) in <top (required)>'
5) BatchXmlImport saves uploaded_files correctly
Failure/Error: id = FactoryGirl.create(:batch_xml_import, uploaded_files: uploaded_files).id
ActiveRecord::RecordInvalid:
Validation failed: Invalid data in <rel:hasModel> for record beginning at line 10 (file: hello.pdf, pid: tufts:1), Invalid data in <rel:hasModel> for record beginning at line 36 (file: hello2.pdf), Invalid data in <rel:hasModel> for record beginning at line 77 (file: compendioussyste00brya.pdf, pid: tufts:3), Invalid data in <rel:hasModel> for record beginning at line 103 (file: defenceofconsfilet00adam_0.pdf), Invalid data in <rel:hasModel> for record beginning at line 130 (file: discourseonplagu00mead.pdf)
# ./spec/models/batch_xml_import_spec.rb:17:in `block (2 levels) in <top (required)>'
6) BatchXmlImport.missing_files shows missing files
Failure/Error: m = FactoryGirl.create(:batch_xml_import, uploaded_files: uploaded_files)
ActiveRecord::RecordInvalid:
Validation failed: Invalid data in <rel:hasModel> for record beginning at line 10 (file: hello.pdf, pid: tufts:1), Invalid data in <rel:hasModel> for record beginning at line 36 (file: hello2.pdf), Invalid data in <rel:hasModel> for record beginning at line 77 (file: compendioussyste00brya.pdf, pid: tufts:3), Invalid data in <rel:hasModel> for record beginning at line 103 (file: defenceofconsfilet00adam_0.pdf), Invalid data in <rel:hasModel> for record beginning at line 130 (file: discourseonplagu00mead.pdf)
# ./spec/models/batch_xml_import_spec.rb:70:in `block (3 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment