modsulator 1.0.3 → 1.0.4.pre.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,12 +7,10 @@ class Validator
7
7
 
8
8
  # Creates a new Validator, using either a provided XML Schema file or the built-in one.
9
9
  # @param schema_file Full path to the desired .xsd file. If none is given, the built-in file will be used.
10
- def initialize(schema_file = '')
11
- if(schema_file == '')
12
- @schema = Nokogiri::XML::Schema(File.read(File.expand_path('../modsulator.xsd', __FILE__)))
13
- else
14
- @schema = Nokogiri::XML::Schema(File.read(schema_file))
15
- end
10
+ def initialize(schema_file = nil)
11
+ schema_file ||= File.expand_path('../modsulator.xsd', __FILE__)
12
+
13
+ @schema = Nokogiri::XML::Schema(File.open(schema_file))
16
14
  end
17
15
 
18
16
 
@@ -1,7 +1,4 @@
1
- require 'spec_helper'
2
- require 'modsulator/modsulator_sheet'
3
-
4
- describe ModsulatorSheet do
1
+ RSpec.describe ModsulatorSheet do
5
2
  describe "#rows" do
6
3
  subject { ModsulatorSheet.new File.join(FIXTURES_DIR, "test_002.csv"), "test_002.csv" }
7
4
 
@@ -1,7 +1,4 @@
1
- require 'equivalent-xml'
2
- require 'modsulator/normalizer'
3
-
4
- describe Normalizer do
1
+ RSpec.describe Normalizer do
5
2
  before :all do
6
3
  # Create common variables shared across tests
7
4
  @fixtures_dir = File.expand_path("../../fixtures", __FILE__)
@@ -1,11 +1,8 @@
1
- require 'equivalent-xml'
2
- require "modsulator"
3
-
4
- describe Modsulator do
1
+ RSpec.describe Modsulator do
5
2
  before :all do
6
3
  # Create common variables shared across tests and clear out temp directory
7
4
  @tmp_dir = File.expand_path("../../../tmp", __FILE__)
8
- Dir.mkdir(@tmp_dir) unless Dir.exists?(@tmp_dir)
5
+ Dir.mkdir(@tmp_dir) unless Dir.exist?(@tmp_dir)
9
6
  Dir.foreach(@tmp_dir) {|f| fn = File.join(@tmp_dir, f); File.delete(fn) if f != '.' && f != '..' && !File.directory?(fn)}
10
7
  end
11
8
 
@@ -1,7 +1,4 @@
1
- require 'equivalent-xml'
2
- require "modsulator/validator"
3
-
4
- describe Validator do
1
+ RSpec.describe Validator do
5
2
  describe "initialize" do
6
3
  it "validates a valid XML file using the internal XML Schema Definition file" do
7
4
 
@@ -16,7 +16,7 @@
16
16
  <physicalLocation type="repository">Stanford</physicalLocation>
17
17
  <physicalLocation type="discovery">Series 1, Box 1, Folder 1</physicalLocation>
18
18
  <shelfLocator>AB 123</shelfLocator>
19
- <url>http://purl.stanford.edu/test1</url>
19
+ <url usage="primary display">http://purl.stanford.edu/test1</url>
20
20
  </location>
21
21
  </mods>
22
22
  </xmlDoc>
@@ -34,7 +34,7 @@
34
34
  <physicalLocation type="repository">Spec Coll</physicalLocation>
35
35
  <physicalLocation type="discovery">Series A | Box A | Folder A</physicalLocation>
36
36
  <shelfLocator>CD 456</shelfLocator>
37
- <url>http://purl.stanford.edu/test2</url>
37
+ <url usage="primary display">http://purl.stanford.edu/test2</url>
38
38
  </location>
39
39
  </mods>
40
40
  </xmlDoc>
@@ -1,29 +1,29 @@
1
1
  <?xml version="1.0"?>
2
- <xmlDocs xmlns="http://library.stanford.edu/xmlDocs" datetime="2016-07-15 10:19:17AM" sourceFile="filled_template_20160711.xlsx">
2
+ <xmlDocs xmlns="http://library.stanford.edu/xmlDocs" datetime="2016-12-01 10:04:45AM" sourceFile="filled_template_20160711.xlsx">
3
3
  <xmlDoc id="descMetadata" objectId="123">
4
4
  <mods xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.loc.gov/mods/v3" version="3.5" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
5
- <titleInfo authority="ti1:authority" authorityURI="ti1:authorityURI" valueURI="ti1:valueURI" nameTitleGroup="ti1:nameTitleGroup" lang="ti1:language" script="ti1:script" transliteration="ti1:transliteration" altRepGroup="ti1:altRepGroup">
5
+ <titleInfo authority="ti1:authority" authorityURI="ti1:authorityURI" valueURI="ti1:valueURI" nameTitleGroup="ti1:nameTitleGroup">
6
6
  <nonSort>ti1:nonSort</nonSort>
7
7
  <title>ti1:title</title>
8
8
  <subTitle>ti1:subTitle</subTitle>
9
9
  <partNumber>ti1:partNumber</partNumber>
10
10
  <partName>ti1:partName</partName>
11
11
  </titleInfo>
12
- <titleInfo type="ti2:type" displayLabel="ti2:displayLabel" authority="ti2:authority" authorityURI="ti2:authorityURI" valueURI="ti2:valueURI" nameTitleGroup="ti2:nameTitleGroup" lang="ti2:language" script="ti2:script" transliteration="ti2:transliteration" altRepGroup="ti2:altRepGroup">
12
+ <titleInfo type="ti2:type" displayLabel="ti2:displayLabel" authority="ti2:authority" authorityURI="ti2:authorityURI" valueURI="ti2:valueURI" nameTitleGroup="ti2:nameTitleGroup">
13
13
  <nonSort>ti2:nonSort</nonSort>
14
14
  <title>ti2:title</title>
15
15
  <subTitle>ti2:subTitle</subTitle>
16
16
  <partNumber>ti2:partNumber</partNumber>
17
17
  <partName>ti2:partName</partName>
18
18
  </titleInfo>
19
- <titleInfo type="ti3:type" displayLabel="ti3:displayLabel" authority="ti3:authority" authorityURI="ti3:authorityURI" valueURI="ti3:valueURI" nameTitleGroup="ti3:nameTitleGroup" lang="ti3:language" script="ti3:script" transliteration="ti3:transliteration" altRepGroup="ti3:altRepGroup">
19
+ <titleInfo type="ti3:type" displayLabel="ti3:displayLabel" authority="ti3:authority" authorityURI="ti3:authorityURI" valueURI="ti3:valueURI" nameTitleGroup="ti3:nameTitleGroup">
20
20
  <nonSort>ti3:nonSort</nonSort>
21
21
  <title>ti3:title</title>
22
22
  <subTitle>ti3:subTitle</subTitle>
23
23
  <partNumber>ti3:partNumber</partNumber>
24
24
  <partName>ti3:partName</partName>
25
25
  </titleInfo>
26
- <name type="na1:type" usage="na1:usage" authority="na1:authority" authorityURI="na1:authorityURI" valueURI="na1:valueURI" nameTitleGroup="na1:nameTitleGroup" lang="na1:language" script="na1:script" transliteration="na1:transliteration" altRepGroup="na1:altRepGroup">
26
+ <name type="na1:type" usage="na1:usage" authority="na1:authority" authorityURI="na1:authorityURI" valueURI="na1:valueURI" nameTitleGroup="na1:nameTitleGroup">
27
27
  <namePart>na1:namePart</namePart>
28
28
  <role>
29
29
  <roleTerm type="code" authority="ro1:authority" authorityURI="ro1:authorityURI" valueURI="ro1:valueURI">ro1:roleCode</roleTerm>
@@ -38,7 +38,7 @@
38
38
  <roleTerm type="text" authority="ro1:authority3" authorityURI="ro1:authorityURI3" valueURI="ro1:valueURI3">ro1:roleText3</roleTerm>
39
39
  </role>
40
40
  </name>
41
- <name type="na2:type" authority="na2:authority" authorityURI="na2:authorityURI" valueURI="na2:valueURI" nameTitleGroup="na2:nameTitleGroup" lang="na2:language" script="na2:script" transliteration="na2:transliteration" altRepGroup="na2:altRepGroup">
41
+ <name type="na2:type" authority="na2:authority" authorityURI="na2:authorityURI" valueURI="na2:valueURI" nameTitleGroup="na2:nameTitleGroup">
42
42
  <namePart>na2:namePart</namePart>
43
43
  <role>
44
44
  <roleTerm type="code" authority="ro2:authority" authorityURI="ro2:authorityURI" valueURI="ro2:valueURI">ro2:roleCode</roleTerm>
@@ -53,7 +53,7 @@
53
53
  <roleTerm type="text" authority="ro2:authority3" authorityURI="ro2:authorityURI3" valueURI="ro2:valueURI3">ro2:roleText3</roleTerm>
54
54
  </role>
55
55
  </name>
56
- <name type="na3:type" authority="na3:authority" authorityURI="na3:authorityURI" valueURI="na3:valueURI" nameTitleGroup="na3:nameTitleGroup" lang="na3:language" script="na3:script" transliteration="na3:transliteration" altRepGroup="na3:altRepGroup">
56
+ <name type="na3:type" authority="na3:authority" authorityURI="na3:authorityURI" valueURI="na3:valueURI" nameTitleGroup="na3:nameTitleGroup">
57
57
  <namePart>na3:namePart</namePart>
58
58
  <role>
59
59
  <roleTerm type="code" authority="ro3:authority" authorityURI="ro3:authorityURI" valueURI="ro3:valueURI">ro3:roleCode</roleTerm>
@@ -68,7 +68,7 @@
68
68
  <roleTerm type="text" authority="ro3:authority3" authorityURI="ro3:authorityURI3" valueURI="ro3:valueURI3">ro3:roleText3</roleTerm>
69
69
  </role>
70
70
  </name>
71
- <name type="na4:type" authority="na4:authority" authorityURI="na4:authorityURI" valueURI="na4:valueURI" nameTitleGroup="na4:nameTitleGroup" lang="na4:language" script="na4:script" transliteration="na4:transliteration" altRepGroup="na4:altRepGroup">
71
+ <name type="na4:type" authority="na4:authority" authorityURI="na4:authorityURI" valueURI="na4:valueURI" nameTitleGroup="na4:nameTitleGroup">
72
72
  <namePart>na4:namePart</namePart>
73
73
  <role>
74
74
  <roleTerm type="code" authority="ro4:authority" authorityURI="ro4:authorityURI" valueURI="ro4:valueURI">ro4:roleCode</roleTerm>
@@ -83,7 +83,7 @@
83
83
  <roleTerm type="text" authority="ro4:authority3" authorityURI="ro4:authorityURI3" valueURI="ro4:valueURI3">ro4:roleText3</roleTerm>
84
84
  </role>
85
85
  </name>
86
- <name type="na5:type" authority="na5:authority" authorityURI="na5:authorityURI" valueURI="na5:valueURI" nameTitleGroup="na5:nameTitleGroup" lang="na5:language" script="na5:script" transliteration="na5:transliteration" altRepGroup="na5:altRepGroup">
86
+ <name type="na5:type" authority="na5:authority" authorityURI="na5:authorityURI" valueURI="na5:valueURI" nameTitleGroup="na5:nameTitleGroup">
87
87
  <namePart>na5:namePart</namePart>
88
88
  <role>
89
89
  <roleTerm type="code" authority="ro5:authority" authorityURI="ro5:authorityURI" valueURI="ro5:valueURI">ro5:roleCode</roleTerm>
@@ -104,12 +104,12 @@
104
104
  <genre type="ge1:type" authority="ge1:authority" authorityURI="ge1:authorityURI" valueURI="ge1:valueURI">ge1:genre</genre>
105
105
  <genre type="ge2:type" authority="ge2:authority" authorityURI="ge2:authorityURI" valueURI="ge2:valueURI">ge2:genre</genre>
106
106
  <genre type="ge3:type" authority="ge3:authority" authorityURI="ge3:authorityURI" valueURI="ge3:valueURI">ge3:genre</genre>
107
- <originInfo displayLabel="or:displayLabel" eventType="or:eventType" altRepGroup="or:altRepGroup">
107
+ <originInfo displayLabel="or:displayLabel" eventType="or:eventType">
108
108
  <place>
109
109
  <placeTerm type="code" authority="pl:authority" authorityURI="pl:authorityURI" valueURI="pl:valueURI">pl:placeCode</placeTerm>
110
110
  <placeTerm type="text" authority="pl:authority" authorityURI="pl:authorityURI" valueURI="pl:valueURI">pl:placeText</placeTerm>
111
111
  </place>
112
- <publisher lang="or:publisherLanguage" script="or:publisherScript" transliteration="or:publisherTransliteration">or:publisher</publisher>
112
+ <publisher>or:publisher</publisher>
113
113
  <dateCreated keyDate="dt:dateCreatedKeyDate" encoding="dt:dateCreatedEncoding" qualifier="dt:dateCreatedQualifier" point="dt:dateCreatedPoint">dt:dateCreated</dateCreated>
114
114
  <dateCreated encoding="dt:dateCreatedEncoding" qualifier="dt:dateCreated2Qualifier" point="dt:dateCreated2Point">dt:dateCreated2</dateCreated>
115
115
  <dateIssued keyDate="dt:dateIssuedKeyDate" encoding="dt:dateIssuedEncoding" qualifier="dt:dateIssuedQualifier" point="dt:dateIssuedPoint">dt:dateIssued</dateIssued>
@@ -118,17 +118,15 @@
118
118
  <dateCaptured encoding="dt:dateCapturedEncoding" qualifier="dt:dateCaptured2Qualifier" point="dt:dateCaptured2Point">dt:dateCaptured2</dateCaptured>
119
119
  <copyrightDate keyDate="dt:copyrightDateKeyDate" encoding="dt:copyrightDateEncoding" qualifier="dt:copyrightDateQualifier" point="dt:copyrightDatePoint">dt:copyrightDate</copyrightDate>
120
120
  <copyrightDate encoding="dt:copyrightDateEncoding" qualifier="dt:copyrightDate2Qualifier" point="dt:copyrightDate2Point">dt:copyrightDate2</copyrightDate>
121
- <dateOther keyDate="dt:dateOtherKeyDate" type="dt:dateOtherType" encoding="dt:dateOtherEncoding" qualifier="dt:dateOtherQualifier" point="dt:dateOtherPoint" script="dt:dateOtherScript" transliteration="dt:dateOtherTransliteration">dt:dateOther</dateOther>
122
- <dateOther type="dt:dateOtherType" encoding="dt:dateOtherEncoding" qualifier="dt:dateOther2Qualifier" point="dt:dateOther2Point" script="dt:dateOtherScript" transliteration="dt:dateOtherTransliteration">dt:dateOther2</dateOther>
123
121
  <edition>or:edition</edition>
124
122
  <issuance>or:issuance</issuance>
125
123
  </originInfo>
126
- <originInfo displayLabel="or2:displayLabel" eventType="or2:eventType" altRepGroup="or2:altRepGroup">
124
+ <originInfo displayLabel="or2:displayLabel" eventType="or2:eventType">
127
125
  <place>
128
126
  <placeTerm type="code" authority="or2:pl:authority" authorityURI="or2:pl:authorityURI" valueURI="or2:pl:valueURI">or2:pl:placeCode</placeTerm>
129
127
  <placeTerm type="text" authority="or2:pl:authority" authorityURI="or2:pl:authorityURI" valueURI="or2:pl:valueURI">or2:pl:placeText</placeTerm>
130
128
  </place>
131
- <publisher lang="or2:publisherLanguage" script="or2:publisherScript" transliteration="or2:publisherTransliteration">or2:publisher</publisher>
129
+ <publisher>or2:publisher</publisher>
132
130
  <dateCreated keyDate="or2:dt:dateCreatedKeyDate" encoding="or2:dt:dateCreatedEncoding" qualifier="or2:dt:dateCreatedQualifier" point="or2:dt:dateCreatedPoint">or2:dt:dateCreated</dateCreated>
133
131
  <dateCreated encoding="or2:dt:dateCreatedEncoding" qualifier="or2:dt:dateCreated2Qualifier" point="or2:dt:dateCreated2Point">or2:dt:dateCreated2</dateCreated>
134
132
  <dateIssued keyDate="or2:dt:dateIssuedKeyDate" encoding="or2:dt:dateIssuedEncoding" qualifier="or2:dt:dateIssuedQualifier" point="or2:dt:dateIssuedPoint">or2:dt:dateIssued</dateIssued>
@@ -137,9 +135,6 @@
137
135
  <dateCaptured encoding="or2:dt:dateCapturedEncoding" qualifier="or2:dt:dateCaptured2Qualifier" point="or2:dt:dateCaptured2Point">or2:dt:dateCaptured2</dateCaptured>
138
136
  <copyrightDate keyDate="or2:dt:copyrightDateKeyDate" encoding="or2:dt:copyrightDateEncoding" qualifier="or2:dt:copyrightDateQualifier" point="or2:dt:copyrightDatePoint">or2:dt:copyrightDate</copyrightDate>
139
137
  <copyrightDate encoding="or2:dt:copyrightDateEncoding" qualifier="or2:dt:copyrightDate2Qualifier" point="or2:dt:copyrightDate2Point">or2:dt:copyrightDate2</copyrightDate>
140
- <dateOther keyDate="or2:dt:dateOtherKeyDate" type="or2:dt:dateOtherType" encoding="or2:dt:dateOtherEncoding" qualifier="or2:dt:dateOtherQualifier" point="or2:dt:dateOtherPoint" script="or2:dt:dateOtherScript" transliteration="or2:dt:dateOtherTransliteration">or2:dt:dateOther</dateOther>
141
- <dateOther type="or2:dt:dateOtherType" encoding="or2:dt:dateOtherEncoding" qualifier="or2:dt:dateOther2Qualifier" point="or2:dt:dateOther2Point" script="or2:dt:dateOtherScript" transliteration="or2:dt:dateOtherTransliteration">or2:dt:dateOther2</dateOther>
142
- <edition>or2:edition</edition>
143
138
  <issuance>or2:issuance</issuance>
144
139
  </originInfo>
145
140
  <language>
@@ -164,42 +159,42 @@
164
159
  <internetMediaType>ph1:internetMediaType3</internetMediaType>
165
160
  <internetMediaType>ph1:internetMediaType4</internetMediaType>
166
161
  <internetMediaType>ph1:internetMediaType5</internetMediaType>
167
- <note displayLabel="ph1:displayLabel1" lang="ph1:language1" script="ph1:script1" transliteration="ph1:transliteration1">ph1:note1</note>
168
- <note displayLabel="ph1:displayLabel2" lang="ph1:language2" script="ph1:script2" transliteration="ph1:transliteration2">ph1:note2</note>
169
- <note displayLabel="ph1:displayLabel3" lang="ph1:language3" script="ph1:script3" transliteration="ph1:transliteration3">ph1:note3</note>
170
- <note displayLabel="ph1:displayLabel4" lang="ph1:language4" script="ph1:script4" transliteration="ph1:transliteration4">ph1:note4</note>
171
- <note displayLabel="ph1:displayLabel5" lang="ph1:language5" script="ph1:script5" transliteration="ph1:transliteration5">ph1:note5</note>
172
- <note displayLabel="ph1:displayLabel6" lang="ph1:language6" script="ph1:script6" transliteration="ph1:transliteration6">ph1:note6</note>
173
- <note displayLabel="ph1:displayLabel7" lang="ph1:language7" script="ph1:script7" transliteration="ph1:transliteration7">ph1:note7</note>
174
- <note displayLabel="ph1:displayLabel8" lang="ph1:language8" script="ph1:script8" transliteration="ph1:transliteration8">ph1:note8</note>
175
- <note displayLabel="ph1:displayLabel9" lang="ph1:language9" script="ph1:script9" transliteration="ph1:transliteration9">ph1:note9</note>
162
+ <note displayLabel="ph1:displayLabel1">ph1:note1</note>
163
+ <note displayLabel="ph1:displayLabel2">ph1:note2</note>
164
+ <note displayLabel="ph1:displayLabel3">ph1:note3</note>
165
+ <note displayLabel="ph1:displayLabel4">ph1:note4</note>
166
+ <note displayLabel="ph1:displayLabel5">ph1:note5</note>
167
+ <note displayLabel="ph1:displayLabel6">ph1:note6</note>
168
+ <note displayLabel="ph1:displayLabel7">ph1:note7</note>
169
+ <note displayLabel="ph1:displayLabel8">ph1:note8</note>
170
+ <note displayLabel="ph1:displayLabel9">ph1:note9</note>
176
171
  </physicalDescription>
177
172
  <physicalDescription>
178
173
  <form authority="ph2:formAuthority" authorityURI="ph2:formAuthorityURI" valueURI="ph2:formValueURI">ph2:form</form>
179
174
  <extent>ph2:extent</extent>
180
175
  <reformattingQuality>ph2:reformattingQuality</reformattingQuality>
181
176
  <digitalOrigin>ph2:digitalOrigin</digitalOrigin>
182
- <note displayLabel="ph2:displayLabel1" lang="ph2:language1" script="ph2:script1" transliteration="ph2:transliteration1">ph2:note1</note>
177
+ <note displayLabel="ph2:displayLabel1">ph2:note1</note>
183
178
  </physicalDescription>
184
179
  <physicalDescription>
185
180
  <form authority="ph3:formAuthority" authorityURI="ph3:formAuthorityURI" valueURI="ph3:formValueURI">ph3:form</form>
186
181
  <extent>ph3:extent</extent>
187
182
  <reformattingQuality>ph3:reformattingQuality</reformattingQuality>
188
183
  <digitalOrigin>ph3:digitalOrigin</digitalOrigin>
189
- <note displayLabel="ph3:displayLabel1" lang="ph3:language1" script="ph3:script1" transliteration="ph3:transliteration1">ph3:note1</note>
184
+ <note displayLabel="ph3:displayLabel1">ph3:note1</note>
190
185
  </physicalDescription>
191
- <abstract displayLabel="ab:displayLabel" lang="ab:language" script="ab:script" transliteration="ab:transliteration">ab:abstract</abstract>
192
- <tableOfContents displayLabel="tc:displayLabel" lang="tc:language" script="tc:script" transliteration="tc:transliteration">tc:tableOfContents</tableOfContents>
193
- <note type="no1:type" displayLabel="no1:displayLabel" lang="no1:language" script="no1:script" transliteration="no1:transliteration" altRepGroup="no1:altRepGroup">no1:note</note>
194
- <note type="no2:type" displayLabel="no2:displayLabel" lang="no2:language" script="no2:script" transliteration="no2:transliteration" altRepGroup="no2:altRepGroup">no2:note</note>
195
- <note type="no3:type" displayLabel="no3:displayLabel" lang="no3:language" script="no3:script" transliteration="no3:transliteration" altRepGroup="no3:altRepGroup">no3:note</note>
196
- <note type="no4:type" displayLabel="no4:displayLabel" lang="no4:language" script="no4:script" transliteration="no4:transliteration" altRepGroup="no4:altRepGroup">no4:note</note>
197
- <note type="no5:type" displayLabel="no5:displayLabel" lang="no5:language" script="no5:script" transliteration="no5:transliteration" altRepGroup="no5:altRepGroup">no5:note</note>
198
- <subject authority="sn1:authority" authorityURI="sn1:authorityURI" valueURI="sn1:valueURI" altRepGroup="sn1:altRepGroup">
199
- <name type="sn1:p1:nameType" authority="sn1:p1:nm:authority" authorityURI="sn1:p1:nm:authorityURI" valueURI="sn1:p1:nm:valueURI" lang="sn1:p1:nm:language" script="sn1:p1:nm:script" transliteration="sn1:p1:nm:transliteration">
186
+ <abstract displayLabel="ab:displayLabel">ab:abstract</abstract>
187
+ <tableOfContents displayLabel="tc:displayLabel">tc:tableOfContents</tableOfContents>
188
+ <note type="no1:type" displayLabel="no1:displayLabel">no1:note</note>
189
+ <note type="no2:type" displayLabel="no2:displayLabel">no2:note</note>
190
+ <note type="no3:type" displayLabel="no3:displayLabel">no3:note</note>
191
+ <note type="no4:type" displayLabel="no4:displayLabel">no4:note</note>
192
+ <note type="no5:type" displayLabel="no5:displayLabel">no5:note</note>
193
+ <subject authority="sn1:authority" authorityURI="sn1:authorityURI" valueURI="sn1:valueURI">
194
+ <name type="sn1:p1:nameType" authority="sn1:p1:nm:authority" authorityURI="sn1:p1:nm:authorityURI" valueURI="sn1:p1:nm:valueURI">
200
195
  <namePart>sn1:p1:name</namePart>
201
196
  </name>
202
- <titleInfo type="sn1:p1:titleType" authority="sn1:p1:ti:authority" authorityURI="sn1:p1:ti:authorityURI" valueURI="sn1:p1:ti:valueURI" lang="sn1:p1:ti:language" script="sn1:p1:ti:script" transliteration="sn1:p1:ti:transliteration">
197
+ <titleInfo type="sn1:p1:titleType" authority="sn1:p1:ti:authority" authorityURI="sn1:p1:ti:authorityURI" valueURI="sn1:p1:ti:valueURI">
203
198
  <title>sn1:p1:title</title>
204
199
  <subTitle>sn1:p1:subTitle</subTitle>
205
200
  <partNumber>sn1:p1:partNumber</partNumber>
@@ -210,11 +205,11 @@
210
205
  <topic authority="sn1:p4:authority" authorityURI="sn1:p4:authorityURI" valueURI="sn1:p4:valueURI">sn1:p4:value</topic>
211
206
  <topic authority="sn1:p5:authority" authorityURI="sn1:p5:authorityURI" valueURI="sn1:p5:valueURI">sn1:p5:value</topic>
212
207
  </subject>
213
- <subject authority="sn2:authority" authorityURI="sn2:authorityURI" valueURI="sn2:valueURI" altRepGroup="sn2:altRepGroup">
214
- <name type="sn2:p1:nameType" authority="sn2:p1:nm:authority" authorityURI="sn2:p1:nm:authorityURI" valueURI="sn2:p1:nm:valueURI" lang="sn2:p1:nm:language" script="sn2:p1:nm:script" transliteration="sn2:p1:nm:transliteration">
208
+ <subject authority="sn2:authority" authorityURI="sn2:authorityURI" valueURI="sn2:valueURI">
209
+ <name type="sn2:p1:nameType" authority="sn2:p1:nm:authority" authorityURI="sn2:p1:nm:authorityURI" valueURI="sn2:p1:nm:valueURI">
215
210
  <namePart>sn2:p1:name</namePart>
216
211
  </name>
217
- <titleInfo type="sn2:p1:titleType" authority="sn2:p1:ti:authority" authorityURI="sn2:p1:ti:authorityURI" valueURI="sn2:p1:ti:valueURI" lang="sn2:p1:ti:language" script="sn2:p1:ti:script" transliteration="sn2:p1:ti:transliteration">
212
+ <titleInfo type="sn2:p1:titleType" authority="sn2:p1:ti:authority" authorityURI="sn2:p1:ti:authorityURI" valueURI="sn2:p1:ti:valueURI">
218
213
  <title>sn2:p1:title</title>
219
214
  <subTitle>sn2:p1:subTitle</subTitle>
220
215
  <partNumber>sn2:p1:partNumber</partNumber>
@@ -225,11 +220,11 @@
225
220
  <topic authority="sn2:p4:authority" authorityURI="sn2:p4:authorityURI" valueURI="sn2:p4:valueURI">sn2:p4:value</topic>
226
221
  <topic authority="sn2:p5:authority" authorityURI="sn2:p5:authorityURI" valueURI="sn2:p5:valueURI">sn2:p5:value</topic>
227
222
  </subject>
228
- <subject authority="sn3:authority" authorityURI="sn3:authorityURI" valueURI="sn3:valueURI" altRepGroup="sn3:altRepGroup">
229
- <name type="sn3:p1:nameType" authority="sn3:p1:nm:authority" authorityURI="sn3:p1:nm:authorityURI" valueURI="sn3:p1:nm:valueURI" lang="sn3:p1:nm:language" script="sn3:p1:nm:script" transliteration="sn3:p1:nm:transliteration">
223
+ <subject authority="sn3:authority" authorityURI="sn3:authorityURI" valueURI="sn3:valueURI">
224
+ <name type="sn3:p1:nameType" authority="sn3:p1:nm:authority" authorityURI="sn3:p1:nm:authorityURI" valueURI="sn3:p1:nm:valueURI">
230
225
  <namePart>sn3:p1:name</namePart>
231
226
  </name>
232
- <titleInfo type="sn3:p1:titleType" authority="sn3:p1:ti:authority" authorityURI="sn3:p1:ti:authorityURI" valueURI="sn3:p1:ti:valueURI" lang="sn3:p1:ti:language" script="sn3:p1:ti:script" transliteration="sn3:p1:ti:transliteration">
227
+ <titleInfo type="sn3:p1:titleType" authority="sn3:p1:ti:authority" authorityURI="sn3:p1:ti:authorityURI" valueURI="sn3:p1:ti:valueURI">
233
228
  <title>sn3:p1:title</title>
234
229
  <subTitle>sn3:p1:subTitle</subTitle>
235
230
  <partNumber>sn3:p1:partNumber</partNumber>
@@ -240,11 +235,11 @@
240
235
  <topic authority="sn3:p4:authority" authorityURI="sn3:p4:authorityURI" valueURI="sn3:p4:valueURI">sn3:p4:value</topic>
241
236
  <topic authority="sn3:p5:authority" authorityURI="sn3:p5:authorityURI" valueURI="sn3:p5:valueURI">sn3:p5:value</topic>
242
237
  </subject>
243
- <subject authority="sn4:authority" authorityURI="sn4:authorityURI" valueURI="sn4:valueURI" altRepGroup="sn4:altRepGroup">
244
- <name type="sn4:p1:nameType" authority="sn4:p1:nm:authority" authorityURI="sn4:p1:nm:authorityURI" valueURI="sn4:p1:nm:valueURI" lang="sn4:p1:nm:language" script="sn4:p1:nm:script" transliteration="sn4:p1:nm:transliteration">
238
+ <subject authority="sn4:authority" authorityURI="sn4:authorityURI" valueURI="sn4:valueURI">
239
+ <name type="sn4:p1:nameType" authority="sn4:p1:nm:authority" authorityURI="sn4:p1:nm:authorityURI" valueURI="sn4:p1:nm:valueURI">
245
240
  <namePart>sn4:p1:name</namePart>
246
241
  </name>
247
- <titleInfo type="sn4:p1:titleType" authority="sn4:p1:ti:authority" authorityURI="sn4:p1:ti:authorityURI" valueURI="sn4:p1:ti:valueURI" lang="sn4:p1:ti:language" script="sn4:p1:ti:script" transliteration="sn4:p1:ti:transliteration">
242
+ <titleInfo type="sn4:p1:titleType" authority="sn4:p1:ti:authority" authorityURI="sn4:p1:ti:authorityURI" valueURI="sn4:p1:ti:valueURI">
248
243
  <title>sn4:p1:title</title>
249
244
  <subTitle>sn4:p1:subTitle</subTitle>
250
245
  <partNumber>sn4:p1:partNumber</partNumber>
@@ -255,11 +250,11 @@
255
250
  <topic authority="sn4:p4:authority" authorityURI="sn4:p4:authorityURI" valueURI="sn4:p4:valueURI">sn4:p4:value</topic>
256
251
  <topic authority="sn4:p5:authority" authorityURI="sn4:p5:authorityURI" valueURI="sn4:p5:valueURI">sn4:p5:value</topic>
257
252
  </subject>
258
- <subject authority="sn5:authority" authorityURI="sn5:authorityURI" valueURI="sn5:valueURI" altRepGroup="sn5:altRepGroup">
259
- <name type="sn5:p1:nameType" authority="sn5:p1:nm:authority" authorityURI="sn5:p1:nm:authorityURI" valueURI="sn5:p1:nm:valueURI" lang="sn5:p1:nm:language" script="sn5:p1:nm:script" transliteration="sn5:p1:nm:transliteration">
253
+ <subject authority="sn5:authority" authorityURI="sn5:authorityURI" valueURI="sn5:valueURI">
254
+ <name type="sn5:p1:nameType" authority="sn5:p1:nm:authority" authorityURI="sn5:p1:nm:authorityURI" valueURI="sn5:p1:nm:valueURI">
260
255
  <namePart>sn5:p1:name</namePart>
261
256
  </name>
262
- <titleInfo type="sn5:p1:titleType" authority="sn5:p1:ti:authority" authorityURI="sn5:p1:ti:authorityURI" valueURI="sn5:p1:ti:valueURI" lang="sn5:p1:ti:language" script="sn5:p1:ti:script" transliteration="sn5:p1:ti:transliteration">
257
+ <titleInfo type="sn5:p1:titleType" authority="sn5:p1:ti:authority" authorityURI="sn5:p1:ti:authorityURI" valueURI="sn5:p1:ti:valueURI">
263
258
  <title>sn5:p1:title</title>
264
259
  <subTitle>sn5:p1:subTitle</subTitle>
265
260
  <partNumber>sn5:p1:partNumber</partNumber>
@@ -270,35 +265,35 @@
270
265
  <topic authority="sn5:p4:authority" authorityURI="sn5:p4:authorityURI" valueURI="sn5:p4:valueURI">sn5:p4:value</topic>
271
266
  <topic authority="sn5:p5:authority" authorityURI="sn5:p5:authorityURI" valueURI="sn5:p5:valueURI">sn5:p5:value</topic>
272
267
  </subject>
273
- <subject authority="su1:authority" authorityURI="su1:authorityURI" valueURI="su1:valueURI" lang="su1:language" script="su1:script" transliteration="su1:transliteration" altRepGroup="su1:altRepGroup">
268
+ <subject authority="su1:authority" authorityURI="su1:authorityURI" valueURI="su1:valueURI">
274
269
  <topic authority="su1:p1:authority" authorityURI="su1:p1:authorityURI" valueURI="su1:p1:valueURI">su1:p1:value</topic>
275
270
  <topic authority="su1:p2:authority" authorityURI="su1:p2:authorityURI" valueURI="su1:p2:valueURI">su1:p2:value</topic>
276
271
  <topic authority="su1:p3:authority" authorityURI="su1:p3:authorityURI" valueURI="su1:p3:valueURI">su1:p3:value</topic>
277
272
  <topic authority="su1:p4:authority" authorityURI="su1:p4:authorityURI" valueURI="su1:p4:valueURI">su1:p4:value</topic>
278
273
  <topic authority="su1:p5:authority" authorityURI="su1:p5:authorityURI" valueURI="su1:p5:valueURI">su1:p5:value</topic>
279
274
  </subject>
280
- <subject authority="su2:authority" authorityURI="su2:authorityURI" valueURI="su2:valueURI" lang="su2:language" script="su2:script" transliteration="su2:transliteration" altRepGroup="su2:altRepGroup">
275
+ <subject authority="su2:authority" authorityURI="su2:authorityURI" valueURI="su2:valueURI">
281
276
  <topic authority="su2:p1:authority" authorityURI="su2:p1:authorityURI" valueURI="su2:p1:valueURI">su2:p1:value</topic>
282
277
  <topic authority="su2:p2:authority" authorityURI="su2:p2:authorityURI" valueURI="su2:p2:valueURI">su2:p2:value</topic>
283
278
  <topic authority="su2:p3:authority" authorityURI="su2:p3:authorityURI" valueURI="su2:p3:valueURI">su2:p3:value</topic>
284
279
  <topic authority="su2:p4:authority" authorityURI="su2:p4:authorityURI" valueURI="su2:p4:valueURI">su2:p4:value</topic>
285
280
  <topic authority="su2:p5:authority" authorityURI="su2:p5:authorityURI" valueURI="su2:p5:valueURI">su2:p5:value</topic>
286
281
  </subject>
287
- <subject authority="su3:authority" authorityURI="su3:authorityURI" valueURI="su3:valueURI" lang="su3:language" script="su3:script" transliteration="su3:transliteration" altRepGroup="su3:altRepGroup">
282
+ <subject authority="su3:authority" authorityURI="su3:authorityURI" valueURI="su3:valueURI">
288
283
  <topic authority="su3:p1:authority" authorityURI="su3:p1:authorityURI" valueURI="su3:p1:valueURI">su3:p1:value</topic>
289
284
  <topic authority="su3:p2:authority" authorityURI="su3:p2:authorityURI" valueURI="su3:p2:valueURI">su3:p2:value</topic>
290
285
  <topic authority="su3:p3:authority" authorityURI="su3:p3:authorityURI" valueURI="su3:p3:valueURI">su3:p3:value</topic>
291
286
  <topic authority="su3:p4:authority" authorityURI="su3:p4:authorityURI" valueURI="su3:p4:valueURI">su3:p4:value</topic>
292
287
  <topic authority="su3:p5:authority" authorityURI="su3:p5:authorityURI" valueURI="su3:p5:valueURI">su3:p5:value</topic>
293
288
  </subject>
294
- <subject authority="su4:authority" authorityURI="su4:authorityURI" valueURI="su4:valueURI" lang="su4:language" script="su4:script" transliteration="su4:transliteration" altRepGroup="su4:altRepGroup">
289
+ <subject authority="su4:authority" authorityURI="su4:authorityURI" valueURI="su4:valueURI">
295
290
  <topic authority="su4:p1:authority" authorityURI="su4:p1:authorityURI" valueURI="su4:p1:valueURI">su4:p1:value</topic>
296
291
  <topic authority="su4:p2:authority" authorityURI="su4:p2:authorityURI" valueURI="su4:p2:valueURI">su4:p2:value</topic>
297
292
  <topic authority="su4:p3:authority" authorityURI="su4:p3:authorityURI" valueURI="su4:p3:valueURI">su4:p3:value</topic>
298
293
  <topic authority="su4:p4:authority" authorityURI="su4:p4:authorityURI" valueURI="su4:p4:valueURI">su4:p4:value</topic>
299
294
  <topic authority="su4:p5:authority" authorityURI="su4:p5:authorityURI" valueURI="su4:p5:valueURI">su4:p5:value</topic>
300
295
  </subject>
301
- <subject authority="su5:authority" authorityURI="su5:authorityURI" valueURI="su5:valueURI" lang="su5:language" script="su5:script" transliteration="su5:transliteration" altRepGroup="su5:altRepGroup">
296
+ <subject authority="su5:authority" authorityURI="su5:authorityURI" valueURI="su5:valueURI">
302
297
  <topic authority="su5:p1:authority" authorityURI="su5:p1:authorityURI" valueURI="su5:p1:valueURI">su5:p1:value</topic>
303
298
  <topic authority="su5:p2:authority" authorityURI="su5:p2:authorityURI" valueURI="su5:p2:valueURI">su5:p2:value</topic>
304
299
  <topic authority="su5:p3:authority" authorityURI="su5:p3:authorityURI" valueURI="su5:p3:valueURI">su5:p3:value</topic>
@@ -318,10 +313,10 @@
318
313
  <identifier type="id4:type" displayLabel="id4:displayLabel">id4:identifier</identifier>
319
314
  <identifier type="id5:type" displayLabel="id5:displayLabel">id5:identifier</identifier>
320
315
  <location>
321
- <physicalLocation type="repository" authority="lo:authority" valueURI="lo:valueURI" lang="lo:language" script="lo:script" transliteration="lo:transliteration">lo:repository</physicalLocation>
316
+ <physicalLocation type="repository" authority="lo:authority" valueURI="lo:valueURI">lo:repository</physicalLocation>
322
317
  <physicalLocation type="discovery">lo:physicalLocation</physicalLocation>
323
318
  <shelfLocator>lo:callNumber</shelfLocator>
324
- <url>lo:purl</url>
319
+ <url usage="primary display">lo:purl</url>
325
320
  </location>
326
321
  <relatedItem type="ri1:type" displayLabel="ri1:displayLabel">
327
322
  <titleInfo>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0"?>
2
+ <xmlDocs xmlns="http://library.stanford.edu/xmlDocs" datetime="2016-12-01 08:40:10AM" sourceFile="location_url.xlsx">
3
+ <xmlDoc id="descMetadata" objectId="aa000aa0000">
4
+ <mods xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.loc.gov/mods/v3" version="3.5" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
5
+ <titleInfo>
6
+ <title>Location URL test</title>
7
+ </titleInfo>
8
+ <location>
9
+ <url usage="primary display">http://purl.stanford.edu/aa000aa0000</url>
10
+ <url displayLabel="Web archive">http://swap.stanford.edu</url>
11
+ </location>
12
+ </mods>
13
+ </xmlDoc>
14
+ </xmlDocs>
@@ -1,11 +1,7 @@
1
- require 'equivalent-xml'
2
- require 'modsulator'
3
- require 'modsulator/validator'
4
-
5
- describe Modsulator do
1
+ RSpec.describe Modsulator do
6
2
  before :all do
7
3
  @tmp_dir = File.expand_path("../../../tmp", __FILE__)
8
- Dir.mkdir(@tmp_dir) unless Dir.exists?(@tmp_dir)
4
+ Dir.mkdir(@tmp_dir) unless Dir.exist?(@tmp_dir)
9
5
  Dir.foreach(@tmp_dir) {|f| fn = File.join(@tmp_dir, f); File.delete(fn) if f != '.' && f != '..' && !File.directory?(fn)}
10
6
  end
11
7
 
@@ -24,7 +20,8 @@ describe Modsulator do
24
20
  'Heckrotte_ChartsOfCoastSurvey.xlsx' => 'Heckrotte_ChartsOfCoastSurvey.xml',
25
21
  'SC1049_metadata.xlsx' => 'SC1049_metadata.xml',
26
22
  'edition_physLoc_intmediatype.xlsx' => 'edition_physLoc_intmediatype.xml',
27
- 'filled_template_20160711.xlsx' => 'filled_template_20160711.xml'
23
+ 'filled_template_20160711.xlsx' => 'filled_template_20160711.xml',
24
+ 'location_url.xlsx' => 'location_url.xml'
28
25
  }.each do |testfile, results_file|
29
26
  it "converts #{testfile} correctly to valid XML" do
30
27
  generated_xml_string = Modsulator.new(File.join(FIXTURES_DIR, testfile), testfile).convert_rows()
@@ -1,7 +1,4 @@
1
- require 'spec_helper'
2
- require 'rubygems'
3
-
4
- describe Modsulator do
1
+ RSpec.describe Modsulator do
5
2
  describe "#validate_headers" do
6
3
  subject { Modsulator.new File.join(FIXTURES_DIR, 'test_002.csv'), 'test_002.csv', template_string: "abc def ghi"}
7
4
  let(:template_xml) { "abc def ghi"}
@@ -13,13 +13,20 @@
13
13
  # The `.rspec` file also contains a few flags that are not defaults but that
14
14
  # users commonly want.
15
15
 
16
- require 'modsulator'
17
- FIXTURES_DIR = File.expand_path("../fixtures", __FILE__)
18
- XML_TEMPLATE = File.join(File.expand_path("../../lib/modsulator", __FILE__), "modsulator_template.xml")
19
-
20
16
  require 'coveralls'
21
17
  Coveralls.wear!
22
18
 
19
+ require 'rspec'
20
+
21
+ require 'modsulator'
22
+ require "modsulator/validator"
23
+
24
+ require 'equivalent-xml'
25
+ require 'equivalent-xml/rspec_matchers'
26
+
27
+ FIXTURES_DIR = File.expand_path('fixtures', __dir__)
28
+
29
+
23
30
  #
24
31
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
25
32
  RSpec.configure do |config|
@@ -46,9 +53,9 @@ RSpec.configure do |config|
46
53
  mocks.verify_partial_doubles = true
47
54
  end
48
55
 
49
- # The settings below are suggested to provide a good initial experience
50
- # with RSpec, but feel free to customize to your heart's content.
51
- =begin
56
+ # The settings below are suggested to provide a good initial experience
57
+ # with RSpec, but feel free to customize to your heart's content.
58
+
52
59
  # These two settings work together to allow you to limit a spec run
53
60
  # to individual examples or groups you care about by tagging them with
54
61
  # `:focus` metadata. When nothing is tagged with `:focus`, all examples
@@ -93,5 +100,4 @@ RSpec.configure do |config|
93
100
  # test failures related to randomization by passing the same `--seed` value
94
101
  # as the one that triggered the failure.
95
102
  Kernel.srand config.seed
96
- =end
97
103
  end