mods 2.0.1 → 2.0.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.
@@ -218,15 +218,15 @@ describe "Mods <originInfo> Element" do
218
218
  context "<placeTerm> child element" do
219
219
  it "should get element values" do
220
220
  vals = @mods_rec.from_str(@place_term_plain_mult).origin_info.place.placeTerm.map { |e| e.text}
221
- vals.size.should == 2
222
- vals.should include("France")
223
- vals.should include("Italy")
221
+ expect(vals.size).to eq(2)
222
+ expect(vals).to include("France")
223
+ expect(vals).to include("Italy")
224
224
  end
225
225
  it "should get authority attribute" do
226
- @mods_rec.from_str(@place_term_code).origin_info.place.placeTerm.authority.should == ["marccountry"]
226
+ expect(@mods_rec.from_str(@place_term_code).origin_info.place.placeTerm.authority).to eq(["marccountry"])
227
227
  end
228
228
  it "should get type(_at) attribute" do
229
- @mods_rec.from_str(@place_term_code).origin_info.place.placeTerm.type_at.should == ["code"]
229
+ expect(@mods_rec.from_str(@place_term_code).origin_info.place.placeTerm.type_at).to eq(["code"])
230
230
  end
231
231
  end # placeTerm
232
232
  end # place
@@ -239,7 +239,7 @@ describe "Mods <originInfo> Element" do
239
239
  end
240
240
  it "should get element values" do
241
241
  vals = @mods_rec.from_str("<mods #{@ns_decl}><originInfo><publisher>Olney</publisher></origin_info></mods>").origin_info.publisher
242
- vals.map { |n| n.text }.should == ["Olney"]
242
+ expect(vals.map { |n| n.text }).to eq(["Olney"])
243
243
  end
244
244
  end
245
245
 
@@ -247,39 +247,39 @@ describe "Mods <originInfo> Element" do
247
247
  it "should recognize each element" do
248
248
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
249
249
  @mods_rec.from_str("<mods #{@ns_decl}><originInfo><#{elname}>date</#{elname}></originInfo></mods>")
250
- @mods_rec.origin_info.send(elname.to_sym).map { |n| n.text }.should == ["date"]
250
+ expect(@mods_rec.origin_info.send(elname.to_sym).map { |n| n.text }).to eq(["date"])
251
251
  }
252
252
  end
253
253
  it "should recognize encoding attribute on each element" do
254
254
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
255
255
  @mods_rec.from_str("<mods #{@ns_decl}><originInfo><#{elname} encoding='foo'>date</#{elname}></originInfo></mods>")
256
- @mods_rec.origin_info.send(elname.to_sym).encoding.should == ["foo"]
256
+ expect(@mods_rec.origin_info.send(elname.to_sym).encoding).to eq(["foo"])
257
257
  }
258
258
  end
259
259
  it "should recognize keyDate attribute" do
260
260
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
261
261
  @mods_rec.from_str("<mods #{@ns_decl}><originInfo><#{elname} keyDate='foo'>date</#{elname}></originInfo></mods>")
262
- @mods_rec.origin_info.send(elname.to_sym).keyDate.should == ["foo"]
262
+ expect(@mods_rec.origin_info.send(elname.to_sym).keyDate).to eq(["foo"])
263
263
  }
264
264
  end
265
265
  it "should recognize point attribute" do
266
266
  # NOTE: values allowed are 'start' and 'end'
267
267
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
268
268
  @mods_rec.from_str("<mods #{@ns_decl}><originInfo><#{elname} point='foo'>date</#{elname}></originInfo></mods>")
269
- @mods_rec.origin_info.send(elname.to_sym).point.should == ["foo"]
269
+ expect(@mods_rec.origin_info.send(elname.to_sym).point).to eq(["foo"])
270
270
  }
271
271
  end
272
272
  it "should recognize qualifier attribute" do
273
273
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
274
274
  @mods_rec.from_str("<mods #{@ns_decl}><originInfo><#{elname} qualifier='foo'>date</#{elname}></originInfo></mods>")
275
- @mods_rec.origin_info.send(elname.to_sym).qualifier.should == ["foo"]
275
+ expect(@mods_rec.origin_info.send(elname.to_sym).qualifier).to eq(["foo"])
276
276
  }
277
277
  end
278
278
  it "should recognize type attribute only on dateOther" do
279
279
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
280
280
  @mods_rec.from_str("<mods #{@ns_decl}><originInfo><#{elname} type='foo'>date</#{elname}></originInfo></mods>")
281
281
  if elname == 'dateOther'
282
- @mods_rec.origin_info.send(elname.to_sym).type_at.should == ["foo"]
282
+ expect(@mods_rec.origin_info.send(elname.to_sym).type_at).to eq(["foo"])
283
283
  else
284
284
  expect { @mods_rec.origin_info.send(elname.to_sym).type_at}.to raise_exception(NoMethodError, /type_at/)
285
285
  end
@@ -289,7 +289,7 @@ describe "Mods <originInfo> Element" do
289
289
 
290
290
  it "<edition> child element" do
291
291
  xml = "<mods #{@ns_decl}><originInfo><edition>7th ed.</edition></originInfo></mods>"
292
- @mods_rec.from_str(xml).origin_info.edition.map { |n| n.text }.should == ['7th ed.']
292
+ expect(@mods_rec.from_str(xml).origin_info.edition.map { |n| n.text }).to eq(['7th ed.'])
293
293
  end
294
294
 
295
295
  context "<issuance> child element" do
@@ -297,7 +297,7 @@ describe "Mods <originInfo> Element" do
297
297
  @ex = "<mods #{@ns_decl}><originInfo><issuance>monographic</issuance></originInfo></mods>"
298
298
  end
299
299
  it "should get element value" do
300
- @mods_rec.from_str(@ex).origin_info.issuance.map { |n| n.text }.should == ['monographic']
300
+ expect(@mods_rec.from_str(@ex).origin_info.issuance.map { |n| n.text }).to eq(['monographic'])
301
301
  end
302
302
  end
303
303
 
@@ -307,10 +307,10 @@ describe "Mods <originInfo> Element" do
307
307
  @origin_info = @mods_rec.from_str(xml).origin_info
308
308
  end
309
309
  it "should get element value" do
310
- @origin_info.frequency.map { |n| n.text }.should == ["Annual"]
310
+ expect(@origin_info.frequency.map { |n| n.text }).to eq(["Annual"])
311
311
  end
312
312
  it "should recognize the authority attribute" do
313
- @origin_info.frequency.authority.should == ["marcfrequency"]
313
+ expect(@origin_info.frequency.authority).to eq(["marcfrequency"])
314
314
  end
315
315
  end
316
316
  end # WITH namspaces
@@ -331,15 +331,15 @@ describe "Mods <originInfo> Element" do
331
331
  context "<placeTerm> child element" do
332
332
  it "should get element values" do
333
333
  vals = @mods_rec.from_str(@place_term_plain_mult, false).origin_info.place.placeTerm.map { |e| e.text}
334
- vals.size.should == 2
335
- vals.should include("France")
336
- vals.should include("Italy")
334
+ expect(vals.size).to eq(2)
335
+ expect(vals).to include("France")
336
+ expect(vals).to include("Italy")
337
337
  end
338
338
  it "should get authority attribute" do
339
- @mods_rec.from_str(@place_term_code, false).origin_info.place.placeTerm.authority.should == ["marccountry"]
339
+ expect(@mods_rec.from_str(@place_term_code, false).origin_info.place.placeTerm.authority).to eq(["marccountry"])
340
340
  end
341
341
  it "should get type(_at) attribute" do
342
- @mods_rec.from_str(@place_term_code, false).origin_info.place.placeTerm.type_at.should == ["code"]
342
+ expect(@mods_rec.from_str(@place_term_code, false).origin_info.place.placeTerm.type_at).to eq(["code"])
343
343
  end
344
344
  end # placeTerm
345
345
  end # place
@@ -352,7 +352,7 @@ describe "Mods <originInfo> Element" do
352
352
  end
353
353
  it "should get element values" do
354
354
  vals = @mods_rec.from_str("<mods><originInfo><publisher>Olney</publisher></origin_info></mods>", false).origin_info.publisher
355
- vals.map { |n| n.text }.should == ["Olney"]
355
+ expect(vals.map { |n| n.text }).to eq(["Olney"])
356
356
  end
357
357
  end
358
358
 
@@ -360,39 +360,39 @@ describe "Mods <originInfo> Element" do
360
360
  it "should recognize each element" do
361
361
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
362
362
  @mods_rec.from_str("<mods><originInfo><#{elname}>date</#{elname}></originInfo></mods>", false)
363
- @mods_rec.origin_info.send(elname.to_sym).map { |n| n.text }.should == ["date"]
363
+ expect(@mods_rec.origin_info.send(elname.to_sym).map { |n| n.text }).to eq(["date"])
364
364
  }
365
365
  end
366
366
  it "should recognize encoding attribute on each element" do
367
367
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
368
368
  @mods_rec.from_str("<mods><originInfo><#{elname} encoding='foo'>date</#{elname}></originInfo></mods>", false)
369
- @mods_rec.origin_info.send(elname.to_sym).encoding.should == ["foo"]
369
+ expect(@mods_rec.origin_info.send(elname.to_sym).encoding).to eq(["foo"])
370
370
  }
371
371
  end
372
372
  it "should recognize keyDate attribute" do
373
373
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
374
374
  @mods_rec.from_str("<mods><originInfo><#{elname} keyDate='foo'>date</#{elname}></originInfo></mods>", false)
375
- @mods_rec.origin_info.send(elname.to_sym).keyDate.should == ["foo"]
375
+ expect(@mods_rec.origin_info.send(elname.to_sym).keyDate).to eq(["foo"])
376
376
  }
377
377
  end
378
378
  it "should recognize point attribute" do
379
379
  # NOTE: values allowed are 'start' and 'end'
380
380
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
381
381
  @mods_rec.from_str("<mods><originInfo><#{elname} point='foo'>date</#{elname}></originInfo></mods>", false)
382
- @mods_rec.origin_info.send(elname.to_sym).point.should == ["foo"]
382
+ expect(@mods_rec.origin_info.send(elname.to_sym).point).to eq(["foo"])
383
383
  }
384
384
  end
385
385
  it "should recognize qualifier attribute" do
386
386
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
387
387
  @mods_rec.from_str("<mods><originInfo><#{elname} qualifier='foo'>date</#{elname}></originInfo></mods>", false)
388
- @mods_rec.origin_info.send(elname.to_sym).qualifier.should == ["foo"]
388
+ expect(@mods_rec.origin_info.send(elname.to_sym).qualifier).to eq(["foo"])
389
389
  }
390
390
  end
391
391
  it "should recognize type attribute only on dateOther" do
392
392
  Mods::ORIGIN_INFO_DATE_ELEMENTS.each { |elname|
393
393
  @mods_rec.from_str("<mods><originInfo><#{elname} type='foo'>date</#{elname}></originInfo></mods>", false)
394
394
  if elname == 'dateOther'
395
- @mods_rec.origin_info.send(elname.to_sym).type_at.should == ["foo"]
395
+ expect(@mods_rec.origin_info.send(elname.to_sym).type_at).to eq(["foo"])
396
396
  else
397
397
  expect { @mods_rec.origin_info.send(elname.to_sym).type_at}.to raise_exception(NoMethodError, /type_at/)
398
398
  end
@@ -402,7 +402,7 @@ describe "Mods <originInfo> Element" do
402
402
 
403
403
  it "<edition> child element" do
404
404
  xml = "<mods><originInfo><edition>7th ed.</edition></originInfo></mods>"
405
- @mods_rec.from_str(xml, false).origin_info.edition.map { |n| n.text }.should == ['7th ed.']
405
+ expect(@mods_rec.from_str(xml, false).origin_info.edition.map { |n| n.text }).to eq(['7th ed.'])
406
406
  end
407
407
 
408
408
  context "<issuance> child element" do
@@ -410,7 +410,7 @@ describe "Mods <originInfo> Element" do
410
410
  @ex = "<mods><originInfo><issuance>monographic</issuance></originInfo></mods>"
411
411
  end
412
412
  it "should get element value" do
413
- @mods_rec.from_str(@ex, false).origin_info.issuance.map { |n| n.text }.should == ['monographic']
413
+ expect(@mods_rec.from_str(@ex, false).origin_info.issuance.map { |n| n.text }).to eq(['monographic'])
414
414
  end
415
415
  end
416
416
 
@@ -420,10 +420,10 @@ describe "Mods <originInfo> Element" do
420
420
  @origin_info = @mods_rec.from_str(xml, false).origin_info
421
421
  end
422
422
  it "should get element value" do
423
- @origin_info.frequency.map { |n| n.text }.should == ["Annual"]
423
+ expect(@origin_info.frequency.map { |n| n.text }).to eq(["Annual"])
424
424
  end
425
425
  it "should recognize the authority attribute" do
426
- @origin_info.frequency.authority.should == ["marcfrequency"]
426
+ expect(@origin_info.frequency.authority).to eq(["marcfrequency"])
427
427
  end
428
428
  end
429
429
  end # WITHOUT namspaces
data/spec/part_spec.rb CHANGED
@@ -40,50 +40,50 @@ describe "Mods <part> Element" do
40
40
  end
41
41
 
42
42
  it "should be a NodeSet" do
43
- [@ex, @ex2, @detail].each { |p| p.should be_an_instance_of(Nokogiri::XML::NodeSet) }
43
+ [@ex, @ex2, @detail].each { |p| expect(p).to be_an_instance_of(Nokogiri::XML::NodeSet) }
44
44
  end
45
45
  it "should have as many members as there are <part> elements in the xml" do
46
- [@ex, @ex2, @detail].each { |p| p.size.should == 1 }
46
+ [@ex, @ex2, @detail].each { |p| expect(p.size).to eq(1) }
47
47
  end
48
48
  it "should recognize type(_at) attribute on <part> element" do
49
49
  @mods_rec.from_str("<mods #{@ns_decl}><part type='val'>anything</part></mods>")
50
- @mods_rec.part.type_at.should == ['val']
50
+ expect(@mods_rec.part.type_at).to eq(['val'])
51
51
  end
52
52
  it "should recognize order attribute on <part> element" do
53
53
  @mods_rec.from_str("<mods #{@ns_decl}><part order='val'>anything</part></mods>")
54
- @mods_rec.part.order.should == ['val']
54
+ expect(@mods_rec.part.order).to eq(['val'])
55
55
  end
56
56
  it "should recognize ID attribute on <part> element as id_at term" do
57
57
  @mods_rec.from_str("<mods #{@ns_decl}><part ID='val'>anything</part></mods>")
58
- @mods_rec.part.id_at.should == ['val']
58
+ expect(@mods_rec.part.id_at).to eq(['val'])
59
59
  end
60
60
 
61
61
  context "<detail> child element" do
62
62
  it "should be a NodeSet" do
63
- [@ex, @ex2, @detail].each { |p| p.detail.should be_an_instance_of(Nokogiri::XML::NodeSet) }
63
+ [@ex, @ex2, @detail].each { |p| expect(p.detail).to be_an_instance_of(Nokogiri::XML::NodeSet) }
64
64
  end
65
65
  it "detail NodeSet should have as many Nodes as there are <detail> elements in the xml" do
66
- [@ex, @ex2, @detail].each { |p| p.detail.size.should == 1 }
66
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.size).to eq(1) }
67
67
  end
68
68
  it "should recognize type(_at) attribute on <detail> element" do
69
- @ex2.detail.type_at.should == ['page number']
70
- @detail.detail.type_at.should == ['issue']
69
+ expect(@ex2.detail.type_at).to eq(['page number'])
70
+ expect(@detail.detail.type_at).to eq(['issue'])
71
71
  end
72
72
  it "should recognize level attribute on <detail> element" do
73
73
  @mods_rec.from_str("<mods #{@ns_decl}><part><detail level='val'>anything</detail></part></mods>")
74
- @mods_rec.part.detail.level.should == ['val']
74
+ expect(@mods_rec.part.detail.level).to eq(['val'])
75
75
  end
76
76
  context "<number> child element" do
77
77
  it "should be a NodeSet" do
78
- [@ex, @ex2, @detail].each { |p| p.detail.number.should be_an_instance_of(Nokogiri::XML::NodeSet) }
78
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.number).to be_an_instance_of(Nokogiri::XML::NodeSet) }
79
79
  end
80
80
  it "number NodeSet should have as many Nodes as there are <number> elements in the xml" do
81
- [@ex2, @detail].each { |p| p.detail.number.size.should == 1 }
82
- @ex.detail.number.size.should == 0
81
+ [@ex2, @detail].each { |p| expect(p.detail.number.size).to eq(1) }
82
+ expect(@ex.detail.number.size).to eq(0)
83
83
  end
84
84
  it "text should get element value" do
85
- @ex2.detail.number.map { |n| n.text }.should == ['3']
86
- @detail.detail.number.map { |n| n.text }.should == ['1']
85
+ expect(@ex2.detail.number.map { |n| n.text }).to eq(['3'])
86
+ expect(@detail.detail.number.map { |n| n.text }).to eq(['1'])
87
87
  end
88
88
  end # <number>
89
89
  context "<caption> child element" do
@@ -92,68 +92,68 @@ describe "Mods <part> Element" do
92
92
  @caption = @mods_rec.part.detail.caption
93
93
  end
94
94
  it "should be a NodeSet" do
95
- [@ex, @ex2, @detail].each { |p| p.detail.caption.should be_an_instance_of(Nokogiri::XML::NodeSet) }
96
- @caption.should be_an_instance_of(Nokogiri::XML::NodeSet)
95
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.caption).to be_an_instance_of(Nokogiri::XML::NodeSet) }
96
+ expect(@caption).to be_an_instance_of(Nokogiri::XML::NodeSet)
97
97
  end
98
98
  it "caption NodeSet should have as many Nodes as there are <caption> elements in the xml" do
99
- [@ex, @ex2].each { |p| p.detail.caption.size.should == 0 }
100
- @detail.detail.caption.size.should == 1
101
- @caption.size.should == 1
99
+ [@ex, @ex2].each { |p| expect(p.detail.caption.size).to eq(0) }
100
+ expect(@detail.detail.caption.size).to eq(1)
101
+ expect(@caption.size).to eq(1)
102
102
  end
103
103
  it "text should get element value" do
104
- @detail.detail.caption.map { |n| n.text }.should == ['no.']
105
- @caption.map { |n| n.text }.should == ['anything']
104
+ expect(@detail.detail.caption.map { |n| n.text }).to eq(['no.'])
105
+ expect(@caption.map { |n| n.text }).to eq(['anything'])
106
106
  end
107
107
  end # <caption>
108
108
  context "<title> child element" do
109
109
  it "should be a NodeSet" do
110
- [@ex, @ex2, @detail].each { |p| p.detail.title.should be_an_instance_of(Nokogiri::XML::NodeSet) }
110
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.title).to be_an_instance_of(Nokogiri::XML::NodeSet) }
111
111
  end
112
112
  it "title NodeSet should have as many Nodes as there are <title> elements in the xml" do
113
- @ex.detail.title.size.should == 1
114
- [@ex2, @detail].each { |p| p.detail.title.size.should == 0 }
113
+ expect(@ex.detail.title.size).to eq(1)
114
+ [@ex2, @detail].each { |p| expect(p.detail.title.size).to eq(0) }
115
115
  end
116
116
  it "text should get element value" do
117
- @ex.detail.title.map { |n| n.text }.should == ['Wayfarers (Poem)']
118
- [@ex2, @detail].each { |p| p.detail.title.map { |n| n.text }.should == [] }
117
+ expect(@ex.detail.title.map { |n| n.text }).to eq(['Wayfarers (Poem)'])
118
+ [@ex2, @detail].each { |p| expect(p.detail.title.map { |n| n.text }).to eq([]) }
119
119
  end
120
120
  end # <title>
121
121
  end # <detail>
122
122
 
123
123
  context "<extent> child element" do
124
124
  it "should be a NodeSet" do
125
- [@ex, @ex2, @detail].each { |p| p.extent.should be_an_instance_of(Nokogiri::XML::NodeSet) }
125
+ [@ex, @ex2, @detail].each { |p| expect(p.extent).to be_an_instance_of(Nokogiri::XML::NodeSet) }
126
126
  end
127
127
  it "extent NodeSet should have as many Nodes as there are <extent> elements in the xml" do
128
- [@ex, @ex2].each { |p| p.extent.size.should == 1 }
129
- @detail.extent.size.should == 0
128
+ [@ex, @ex2].each { |p| expect(p.extent.size).to eq(1) }
129
+ expect(@detail.extent.size).to eq(0)
130
130
  end
131
131
  it "should recognize unit attribute on <extent> element" do
132
- [@ex, @ex2].each { |p| p.extent.unit.should == ['pages'] }
132
+ [@ex, @ex2].each { |p| expect(p.extent.unit).to eq(['pages']) }
133
133
  end
134
134
  context "<start> child element" do
135
135
  it "should be a NodeSet" do
136
- [@ex, @ex2, @detail].each { |p| p.extent.start.should be_an_instance_of(Nokogiri::XML::NodeSet) }
136
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.start).to be_an_instance_of(Nokogiri::XML::NodeSet) }
137
137
  end
138
138
  it "start NodeSet should have as many Nodes as there are <start> elements in the xml" do
139
- [@ex, @ex2].each { |p| p.extent.start.size.should == 1 }
140
- @detail.extent.start.size.should == 0
139
+ [@ex, @ex2].each { |p| expect(p.extent.start.size).to eq(1) }
140
+ expect(@detail.extent.start.size).to eq(0)
141
141
  end
142
142
  it "text should get element value" do
143
- @ex.extent.start.map { |n| n.text }.should == ['97']
144
- @ex2.extent.start.map { |n| n.text }.should == ['3']
143
+ expect(@ex.extent.start.map { |n| n.text }).to eq(['97'])
144
+ expect(@ex2.extent.start.map { |n| n.text }).to eq(['3'])
145
145
  end
146
146
  end # <start>
147
147
  context "<end> child element" do
148
148
  it "should be a NodeSet" do
149
- [@ex, @ex2, @detail].each { |p| p.extent.end.should be_an_instance_of(Nokogiri::XML::NodeSet) }
149
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.end).to be_an_instance_of(Nokogiri::XML::NodeSet) }
150
150
  end
151
151
  it "end NodeSet should have as many Nodes as there are <end> elements in the xml" do
152
- @ex.extent.end.size.should == 1
153
- [@ex2, @detail].each { |p| p.extent.end.size.should == 0 }
152
+ expect(@ex.extent.end.size).to eq(1)
153
+ [@ex2, @detail].each { |p| expect(p.extent.end.size).to eq(0) }
154
154
  end
155
155
  it "text should get element value" do
156
- @ex.extent.end.map { |n| n.text }.should == ['98']
156
+ expect(@ex.extent.end.map { |n| n.text }).to eq(['98'])
157
157
  end
158
158
  end # <end>
159
159
  context "<total> child element" do
@@ -162,15 +162,15 @@ describe "Mods <part> Element" do
162
162
  @total = @mods_rec.part.extent.total
163
163
  end
164
164
  it "should be a NodeSet" do
165
- [@ex, @ex2, @detail].each { |p| p.extent.total.should be_an_instance_of(Nokogiri::XML::NodeSet) }
166
- @total.should be_an_instance_of(Nokogiri::XML::NodeSet)
165
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.total).to be_an_instance_of(Nokogiri::XML::NodeSet) }
166
+ expect(@total).to be_an_instance_of(Nokogiri::XML::NodeSet)
167
167
  end
168
168
  it "total NodeSet should have as many Nodes as there are <total> elements in the xml" do
169
- [@ex, @ex2, @detail].each { |p| p.extent.total.size.should == 0 }
170
- @total.size.should == 1
169
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.total.size).to eq(0) }
170
+ expect(@total.size).to eq(1)
171
171
  end
172
172
  it "text should get element value" do
173
- @total.map { |n| n.text }.should == ['anything']
173
+ expect(@total.map { |n| n.text }).to eq(['anything'])
174
174
  end
175
175
  end # <total>
176
176
  context "<list> child element" do
@@ -179,15 +179,15 @@ describe "Mods <part> Element" do
179
179
  @list = @mods_rec.part.extent.list
180
180
  end
181
181
  it "should be a NodeSet" do
182
- [@ex, @ex2, @detail].each { |p| p.extent.list.should be_an_instance_of(Nokogiri::XML::NodeSet) }
183
- @list.should be_an_instance_of(Nokogiri::XML::NodeSet)
182
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.list).to be_an_instance_of(Nokogiri::XML::NodeSet) }
183
+ expect(@list).to be_an_instance_of(Nokogiri::XML::NodeSet)
184
184
  end
185
185
  it "list NodeSet should have as many Nodes as there are <list> elements in the xml" do
186
- [@ex, @ex2, @detail].each { |p| p.extent.list.size.should == 0 }
187
- @list.size.should == 1
186
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.list.size).to eq(0) }
187
+ expect(@list.size).to eq(1)
188
188
  end
189
189
  it "text should get element value" do
190
- @list.map { |n| n.text }.should == ['anything']
190
+ expect(@list.map { |n| n.text }).to eq(['anything'])
191
191
  end
192
192
  end # <list>
193
193
  end # <extent>
@@ -197,17 +197,17 @@ describe "Mods <part> Element" do
197
197
  @date = @mods_rec.from_str("<mods #{@ns_decl}><part><date encoding='w3cdtf'>1999</date></part></mods>").part.date
198
198
  end
199
199
  it "should be a NodeSet" do
200
- [@ex, @ex2, @detail].each { |p| p.date.should be_an_instance_of(Nokogiri::XML::NodeSet) }
201
- @date.should be_an_instance_of(Nokogiri::XML::NodeSet)
200
+ [@ex, @ex2, @detail].each { |p| expect(p.date).to be_an_instance_of(Nokogiri::XML::NodeSet) }
201
+ expect(@date).to be_an_instance_of(Nokogiri::XML::NodeSet)
202
202
  end
203
203
  it "extent NodeSet should have as many Nodes as there are <extent> elements in the xml" do
204
- [@ex, @ex2, @detail].each { |p| p.date.size.should == 0 }
205
- @date.size.should == 1
204
+ [@ex, @ex2, @detail].each { |p| expect(p.date.size).to eq(0) }
205
+ expect(@date.size).to eq(1)
206
206
  end
207
207
  it "should recognize all date attributes except keyDate" do
208
208
  Mods::DATE_ATTRIBS.reject { |n| n == 'keyDate' }.each { |a|
209
209
  @mods_rec.from_str("<mods #{@ns_decl}><part><date #{a}='attr_val'>zzz</date></part></mods>")
210
- @mods_rec.part.date.send(a.to_sym).should == ['attr_val']
210
+ expect(@mods_rec.part.date.send(a.to_sym)).to eq(['attr_val'])
211
211
  }
212
212
  end
213
213
  it "should not recognize keyDate attribute" do
@@ -221,20 +221,20 @@ describe "Mods <part> Element" do
221
221
  @text_ns = @mods_rec.from_str("<mods #{@ns_decl}><part><text encoding='w3cdtf'>1999</text></part></mods>").part.text_el
222
222
  end
223
223
  it "should be a NodeSet" do
224
- [@ex, @ex2, @detail].each { |p| p.text_el.should be_an_instance_of(Nokogiri::XML::NodeSet) }
225
- @text_ns.should be_an_instance_of(Nokogiri::XML::NodeSet)
224
+ [@ex, @ex2, @detail].each { |p| expect(p.text_el).to be_an_instance_of(Nokogiri::XML::NodeSet) }
225
+ expect(@text_ns).to be_an_instance_of(Nokogiri::XML::NodeSet)
226
226
  end
227
227
  it "text_el NodeSet should have as many Nodes as there are <text> elements in the xml" do
228
- [@ex, @ex2, @detail].each { |p| p.text_el.size.should == 0 }
229
- @text_ns.size.should == 1
228
+ [@ex, @ex2, @detail].each { |p| expect(p.text_el.size).to eq(0) }
229
+ expect(@text_ns.size).to eq(1)
230
230
  end
231
231
  it "should recognize displayLabel attribute" do
232
232
  @mods_rec.from_str("<mods #{@ns_decl}><part><text displayLabel='foo'>zzz</text></part></mods>")
233
- @mods_rec.part.text_el.displayLabel.should == ['foo']
233
+ expect(@mods_rec.part.text_el.displayLabel).to eq(['foo'])
234
234
  end
235
235
  it "should recognize type(_at) attribute on <text> element" do
236
236
  @mods_rec.from_str("<mods #{@ns_decl}><part><text type='bar'>anything</text></part></mods>")
237
- @mods_rec.part.text_el.type_at.should == ['bar']
237
+ expect(@mods_rec.part.text_el.type_at).to eq(['bar'])
238
238
  end
239
239
  end # <text>
240
240
  end # WITH namespaces
@@ -267,50 +267,50 @@ describe "Mods <part> Element" do
267
267
  end
268
268
 
269
269
  it "should be a NodeSet" do
270
- [@ex, @ex2, @detail].each { |p| p.should be_an_instance_of(Nokogiri::XML::NodeSet) }
270
+ [@ex, @ex2, @detail].each { |p| expect(p).to be_an_instance_of(Nokogiri::XML::NodeSet) }
271
271
  end
272
272
  it "should have as many members as there are <part> elements in the xml" do
273
- [@ex, @ex2, @detail].each { |p| p.size.should == 1 }
273
+ [@ex, @ex2, @detail].each { |p| expect(p.size).to eq(1) }
274
274
  end
275
275
  it "should recognize type(_at) attribute on <part> element" do
276
276
  @mods_rec.from_str("<mods><part type='val'>anything</part></mods>", false)
277
- @mods_rec.part.type_at.should == ['val']
277
+ expect(@mods_rec.part.type_at).to eq(['val'])
278
278
  end
279
279
  it "should recognize order attribute on <part> element" do
280
280
  @mods_rec.from_str("<mods><part order='val'>anything</part></mods>", false)
281
- @mods_rec.part.order.should == ['val']
281
+ expect(@mods_rec.part.order).to eq(['val'])
282
282
  end
283
283
  it "should recognize ID attribute on <part> element as id_at term" do
284
284
  @mods_rec.from_str("<mods><part ID='val'>anything</part></mods>", false)
285
- @mods_rec.part.id_at.should == ['val']
285
+ expect(@mods_rec.part.id_at).to eq(['val'])
286
286
  end
287
287
 
288
288
  context "<detail> child element" do
289
289
  it "should be a NodeSet" do
290
- [@ex, @ex2, @detail].each { |p| p.detail.should be_an_instance_of(Nokogiri::XML::NodeSet) }
290
+ [@ex, @ex2, @detail].each { |p| expect(p.detail).to be_an_instance_of(Nokogiri::XML::NodeSet) }
291
291
  end
292
292
  it "detail NodeSet should have as many Nodes as there are <detail> elements in the xml" do
293
- [@ex, @ex2, @detail].each { |p| p.detail.size.should == 1 }
293
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.size).to eq(1) }
294
294
  end
295
295
  it "should recognize type(_at) attribute on <detail> element" do
296
- @ex2.detail.type_at.should == ['page number']
297
- @detail.detail.type_at.should == ['issue']
296
+ expect(@ex2.detail.type_at).to eq(['page number'])
297
+ expect(@detail.detail.type_at).to eq(['issue'])
298
298
  end
299
299
  it "should recognize level attribute on <detail> element" do
300
300
  @mods_rec.from_str("<mods><part><detail level='val'>anything</detail></part></mods>", false)
301
- @mods_rec.part.detail.level.should == ['val']
301
+ expect(@mods_rec.part.detail.level).to eq(['val'])
302
302
  end
303
303
  context "<number> child element" do
304
304
  it "should be a NodeSet" do
305
- [@ex, @ex2, @detail].each { |p| p.detail.number.should be_an_instance_of(Nokogiri::XML::NodeSet) }
305
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.number).to be_an_instance_of(Nokogiri::XML::NodeSet) }
306
306
  end
307
307
  it "number NodeSet should have as many Nodes as there are <number> elements in the xml" do
308
- [@ex2, @detail].each { |p| p.detail.number.size.should == 1 }
309
- @ex.detail.number.size.should == 0
308
+ [@ex2, @detail].each { |p| expect(p.detail.number.size).to eq(1) }
309
+ expect(@ex.detail.number.size).to eq(0)
310
310
  end
311
311
  it "text should get element value" do
312
- @ex2.detail.number.map { |n| n.text }.should == ['3']
313
- @detail.detail.number.map { |n| n.text }.should == ['1']
312
+ expect(@ex2.detail.number.map { |n| n.text }).to eq(['3'])
313
+ expect(@detail.detail.number.map { |n| n.text }).to eq(['1'])
314
314
  end
315
315
  end # <number>
316
316
  context "<caption> child element" do
@@ -319,68 +319,68 @@ describe "Mods <part> Element" do
319
319
  @caption = @mods_rec.part.detail.caption
320
320
  end
321
321
  it "should be a NodeSet" do
322
- [@ex, @ex2, @detail].each { |p| p.detail.caption.should be_an_instance_of(Nokogiri::XML::NodeSet) }
323
- @caption.should be_an_instance_of(Nokogiri::XML::NodeSet)
322
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.caption).to be_an_instance_of(Nokogiri::XML::NodeSet) }
323
+ expect(@caption).to be_an_instance_of(Nokogiri::XML::NodeSet)
324
324
  end
325
325
  it "caption NodeSet should have as many Nodes as there are <caption> elements in the xml" do
326
- [@ex, @ex2].each { |p| p.detail.caption.size.should == 0 }
327
- @detail.detail.caption.size.should == 1
328
- @caption.size.should == 1
326
+ [@ex, @ex2].each { |p| expect(p.detail.caption.size).to eq(0) }
327
+ expect(@detail.detail.caption.size).to eq(1)
328
+ expect(@caption.size).to eq(1)
329
329
  end
330
330
  it "text should get element value" do
331
- @detail.detail.caption.map { |n| n.text }.should == ['no.']
332
- @caption.map { |n| n.text }.should == ['anything']
331
+ expect(@detail.detail.caption.map { |n| n.text }).to eq(['no.'])
332
+ expect(@caption.map { |n| n.text }).to eq(['anything'])
333
333
  end
334
334
  end # <caption>
335
335
  context "<title> child element" do
336
336
  it "should be a NodeSet" do
337
- [@ex, @ex2, @detail].each { |p| p.detail.title.should be_an_instance_of(Nokogiri::XML::NodeSet) }
337
+ [@ex, @ex2, @detail].each { |p| expect(p.detail.title).to be_an_instance_of(Nokogiri::XML::NodeSet) }
338
338
  end
339
339
  it "title NodeSet should have as many Nodes as there are <title> elements in the xml" do
340
- @ex.detail.title.size.should == 1
341
- [@ex2, @detail].each { |p| p.detail.title.size.should == 0 }
340
+ expect(@ex.detail.title.size).to eq(1)
341
+ [@ex2, @detail].each { |p| expect(p.detail.title.size).to eq(0) }
342
342
  end
343
343
  it "text should get element value" do
344
- @ex.detail.title.map { |n| n.text }.should == ['Wayfarers (Poem)']
345
- [@ex2, @detail].each { |p| p.detail.title.map { |n| n.text }.should == [] }
344
+ expect(@ex.detail.title.map { |n| n.text }).to eq(['Wayfarers (Poem)'])
345
+ [@ex2, @detail].each { |p| expect(p.detail.title.map { |n| n.text }).to eq([]) }
346
346
  end
347
347
  end # <title>
348
348
  end # <detail>
349
349
 
350
350
  context "<extent> child element" do
351
351
  it "should be a NodeSet" do
352
- [@ex, @ex2, @detail].each { |p| p.extent.should be_an_instance_of(Nokogiri::XML::NodeSet) }
352
+ [@ex, @ex2, @detail].each { |p| expect(p.extent).to be_an_instance_of(Nokogiri::XML::NodeSet) }
353
353
  end
354
354
  it "extent NodeSet should have as many Nodes as there are <extent> elements in the xml" do
355
- [@ex, @ex2].each { |p| p.extent.size.should == 1 }
356
- @detail.extent.size.should == 0
355
+ [@ex, @ex2].each { |p| expect(p.extent.size).to eq(1) }
356
+ expect(@detail.extent.size).to eq(0)
357
357
  end
358
358
  it "should recognize unit attribute on <extent> element" do
359
- [@ex, @ex2].each { |p| p.extent.unit.should == ['pages'] }
359
+ [@ex, @ex2].each { |p| expect(p.extent.unit).to eq(['pages']) }
360
360
  end
361
361
  context "<start> child element" do
362
362
  it "should be a NodeSet" do
363
- [@ex, @ex2, @detail].each { |p| p.extent.start.should be_an_instance_of(Nokogiri::XML::NodeSet) }
363
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.start).to be_an_instance_of(Nokogiri::XML::NodeSet) }
364
364
  end
365
365
  it "start NodeSet should have as many Nodes as there are <start> elements in the xml" do
366
- [@ex, @ex2].each { |p| p.extent.start.size.should == 1 }
367
- @detail.extent.start.size.should == 0
366
+ [@ex, @ex2].each { |p| expect(p.extent.start.size).to eq(1) }
367
+ expect(@detail.extent.start.size).to eq(0)
368
368
  end
369
369
  it "text should get element value" do
370
- @ex.extent.start.map { |n| n.text }.should == ['97']
371
- @ex2.extent.start.map { |n| n.text }.should == ['3']
370
+ expect(@ex.extent.start.map { |n| n.text }).to eq(['97'])
371
+ expect(@ex2.extent.start.map { |n| n.text }).to eq(['3'])
372
372
  end
373
373
  end # <start>
374
374
  context "<end> child element" do
375
375
  it "should be a NodeSet" do
376
- [@ex, @ex2, @detail].each { |p| p.extent.end.should be_an_instance_of(Nokogiri::XML::NodeSet) }
376
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.end).to be_an_instance_of(Nokogiri::XML::NodeSet) }
377
377
  end
378
378
  it "end NodeSet should have as many Nodes as there are <end> elements in the xml" do
379
- @ex.extent.end.size.should == 1
380
- [@ex2, @detail].each { |p| p.extent.end.size.should == 0 }
379
+ expect(@ex.extent.end.size).to eq(1)
380
+ [@ex2, @detail].each { |p| expect(p.extent.end.size).to eq(0) }
381
381
  end
382
382
  it "text should get element value" do
383
- @ex.extent.end.map { |n| n.text }.should == ['98']
383
+ expect(@ex.extent.end.map { |n| n.text }).to eq(['98'])
384
384
  end
385
385
  end # <end>
386
386
  context "<total> child element" do
@@ -389,15 +389,15 @@ describe "Mods <part> Element" do
389
389
  @total = @mods_rec.part.extent.total
390
390
  end
391
391
  it "should be a NodeSet" do
392
- [@ex, @ex2, @detail].each { |p| p.extent.total.should be_an_instance_of(Nokogiri::XML::NodeSet) }
393
- @total.should be_an_instance_of(Nokogiri::XML::NodeSet)
392
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.total).to be_an_instance_of(Nokogiri::XML::NodeSet) }
393
+ expect(@total).to be_an_instance_of(Nokogiri::XML::NodeSet)
394
394
  end
395
395
  it "total NodeSet should have as many Nodes as there are <total> elements in the xml" do
396
- [@ex, @ex2, @detail].each { |p| p.extent.total.size.should == 0 }
397
- @total.size.should == 1
396
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.total.size).to eq(0) }
397
+ expect(@total.size).to eq(1)
398
398
  end
399
399
  it "text should get element value" do
400
- @total.map { |n| n.text }.should == ['anything']
400
+ expect(@total.map { |n| n.text }).to eq(['anything'])
401
401
  end
402
402
  end # <total>
403
403
  context "<list> child element" do
@@ -406,15 +406,15 @@ describe "Mods <part> Element" do
406
406
  @list = @mods_rec.part.extent.list
407
407
  end
408
408
  it "should be a NodeSet" do
409
- [@ex, @ex2, @detail].each { |p| p.extent.list.should be_an_instance_of(Nokogiri::XML::NodeSet) }
410
- @list.should be_an_instance_of(Nokogiri::XML::NodeSet)
409
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.list).to be_an_instance_of(Nokogiri::XML::NodeSet) }
410
+ expect(@list).to be_an_instance_of(Nokogiri::XML::NodeSet)
411
411
  end
412
412
  it "list NodeSet should have as many Nodes as there are <list> elements in the xml" do
413
- [@ex, @ex2, @detail].each { |p| p.extent.list.size.should == 0 }
414
- @list.size.should == 1
413
+ [@ex, @ex2, @detail].each { |p| expect(p.extent.list.size).to eq(0) }
414
+ expect(@list.size).to eq(1)
415
415
  end
416
416
  it "text should get element value" do
417
- @list.map { |n| n.text }.should == ['anything']
417
+ expect(@list.map { |n| n.text }).to eq(['anything'])
418
418
  end
419
419
  end # <list>
420
420
  end # <extent>
@@ -424,17 +424,17 @@ describe "Mods <part> Element" do
424
424
  @date = @mods_rec.from_str("<mods><part><date encoding='w3cdtf'>1999</date></part></mods>", false).part.date
425
425
  end
426
426
  it "should be a NodeSet" do
427
- [@ex, @ex2, @detail].each { |p| p.date.should be_an_instance_of(Nokogiri::XML::NodeSet) }
428
- @date.should be_an_instance_of(Nokogiri::XML::NodeSet)
427
+ [@ex, @ex2, @detail].each { |p| expect(p.date).to be_an_instance_of(Nokogiri::XML::NodeSet) }
428
+ expect(@date).to be_an_instance_of(Nokogiri::XML::NodeSet)
429
429
  end
430
430
  it "extent NodeSet should have as many Nodes as there are <extent> elements in the xml" do
431
- [@ex, @ex2, @detail].each { |p| p.date.size.should == 0 }
432
- @date.size.should == 1
431
+ [@ex, @ex2, @detail].each { |p| expect(p.date.size).to eq(0) }
432
+ expect(@date.size).to eq(1)
433
433
  end
434
434
  it "should recognize all date attributes except keyDate" do
435
435
  Mods::DATE_ATTRIBS.reject { |n| n == 'keyDate' }.each { |a|
436
436
  @mods_rec.from_str("<mods><part><date #{a}='attr_val'>zzz</date></part></mods>", false)
437
- @mods_rec.part.date.send(a.to_sym).should == ['attr_val']
437
+ expect(@mods_rec.part.date.send(a.to_sym)).to eq(['attr_val'])
438
438
  }
439
439
  end
440
440
  it "should not recognize keyDate attribute" do
@@ -448,20 +448,20 @@ describe "Mods <part> Element" do
448
448
  @text_ns = @mods_rec.from_str("<mods><part><text encoding='w3cdtf'>1999</text></part></mods>", false).part.text_el
449
449
  end
450
450
  it "should be a NodeSet" do
451
- [@ex, @ex2, @detail].each { |p| p.text_el.should be_an_instance_of(Nokogiri::XML::NodeSet) }
452
- @text_ns.should be_an_instance_of(Nokogiri::XML::NodeSet)
451
+ [@ex, @ex2, @detail].each { |p| expect(p.text_el).to be_an_instance_of(Nokogiri::XML::NodeSet) }
452
+ expect(@text_ns).to be_an_instance_of(Nokogiri::XML::NodeSet)
453
453
  end
454
454
  it "text_el NodeSet should have as many Nodes as there are <text> elements in the xml" do
455
- [@ex, @ex2, @detail].each { |p| p.text_el.size.should == 0 }
456
- @text_ns.size.should == 1
455
+ [@ex, @ex2, @detail].each { |p| expect(p.text_el.size).to eq(0) }
456
+ expect(@text_ns.size).to eq(1)
457
457
  end
458
458
  it "should recognize displayLabel attribute" do
459
459
  @mods_rec.from_str("<mods><part><text displayLabel='foo'>zzz</text></part></mods>", false)
460
- @mods_rec.part.text_el.displayLabel.should == ['foo']
460
+ expect(@mods_rec.part.text_el.displayLabel).to eq(['foo'])
461
461
  end
462
462
  it "should recognize type(_at) attribute on <text> element" do
463
463
  @mods_rec.from_str("<mods><part><text type='bar'>anything</text></part></mods>", false)
464
- @mods_rec.part.text_el.type_at.should == ['bar']
464
+ expect(@mods_rec.part.text_el.type_at).to eq(['bar'])
465
465
  end
466
466
  end # <text>
467
467
  end # WITHOUT namespaces