stanford-mods 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +358 -3
- data/.travis.yml +1 -4
- data/Gemfile +3 -4
- data/Rakefile +3 -3
- data/lib/marc_countries.rb +381 -381
- data/lib/stanford-mods.rb +1 -0
- data/lib/stanford-mods/coordinate.rb +14 -36
- data/lib/stanford-mods/date_parsing.rb +7 -8
- data/lib/stanford-mods/geo_spatial.rb +32 -12
- data/lib/stanford-mods/geo_utils.rb +28 -0
- data/lib/stanford-mods/imprint.rb +1 -1
- data/lib/stanford-mods/name.rb +7 -15
- data/lib/stanford-mods/origin_info.rb +35 -37
- data/lib/stanford-mods/physical_location.rb +6 -4
- data/lib/stanford-mods/searchworks.rb +149 -182
- data/lib/stanford-mods/searchworks_languages.rb +3 -3
- data/lib/stanford-mods/searchworks_subjects.rb +16 -18
- data/lib/stanford-mods/version.rb +1 -1
- data/spec/date_parsing_spec.rb +17 -19
- data/spec/fixtures/searchworks_imprint_data.rb +1 -1
- data/spec/fixtures/searchworks_pub_date_data.rb +1 -1
- data/spec/fixtures/spotlight_pub_date_data.rb +1 -1
- data/spec/geo_spatial_spec.rb +51 -5
- data/spec/imprint_spec.rb +4 -6
- data/spec/lib/stanford-mods/coordinate_spec.rb +0 -2
- data/spec/name_spec.rb +0 -2
- data/spec/origin_info_spec.rb +26 -28
- data/spec/physical_location_spec.rb +0 -3
- data/spec/searchworks_basic_spec.rb +1 -2
- data/spec/searchworks_format_spec.rb +35 -39
- data/spec/searchworks_pub_dates_spec.rb +0 -5
- data/spec/searchworks_spec.rb +1 -7
- data/spec/searchworks_subject_raw_spec.rb +0 -5
- data/spec/searchworks_subject_spec.rb +2 -9
- data/spec/searchworks_title_spec.rb +0 -2
- data/spec/spec_helper.rb +2 -5
- data/spec/sw_publication_spec.rb +1 -2
- data/stanford-mods.gemspec +1 -2
- metadata +4 -4
@@ -4,7 +4,7 @@ require 'stanford-mods/searchworks'
|
|
4
4
|
|
5
5
|
describe 'Basic construction' do
|
6
6
|
before(:each) do
|
7
|
-
@dsxml
|
7
|
+
@dsxml = <<-EOF
|
8
8
|
<mods xmlns="http://www.loc.gov/mods/v3"
|
9
9
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3"
|
10
10
|
xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd">
|
@@ -46,4 +46,3 @@ describe 'Basic construction' do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
2
|
describe "Format fields (searchworks.rb)" do
|
5
|
-
|
6
3
|
before(:all) do
|
7
4
|
@smods_rec = Stanford::Mods::Record.new
|
8
5
|
@ns_decl = "xmlns='#{Mods::MODS_NS}'"
|
@@ -18,7 +15,7 @@ describe "Format fields (searchworks.rb)" do
|
|
18
15
|
expect(@smods_rec.format).to eq ['Book']
|
19
16
|
end
|
20
17
|
context "genre" do
|
21
|
-
it "'book chapter'", :
|
18
|
+
it "'book chapter'", email: 'mods-squad 2014-05-22, Joanna Dyla' do
|
22
19
|
m = "<mods #{@ns_decl}><genre>book chapter</genre><typeOfResource>text</typeOfResource></mods>"
|
23
20
|
@smods_rec.from_str(m)
|
24
21
|
expect(@smods_rec.format).to eq ['Book']
|
@@ -29,7 +26,7 @@ describe "Format fields (searchworks.rb)" do
|
|
29
26
|
@smods_rec.from_str(m)
|
30
27
|
expect(@smods_rec.format).to eq ['Book']
|
31
28
|
end
|
32
|
-
it "'issue brief'", :
|
29
|
+
it "'issue brief'", email: 'mods-squad 2014-05-22, Joanna Dyla' do
|
33
30
|
m = "<mods #{@ns_decl}><genre>issue brief</genre><typeOfResource>text</typeOfResource></mods>"
|
34
31
|
@smods_rec.from_str(m)
|
35
32
|
expect(@smods_rec.format).to eq ['Book']
|
@@ -40,7 +37,7 @@ describe "Format fields (searchworks.rb)" do
|
|
40
37
|
@smods_rec.from_str(m)
|
41
38
|
expect(@smods_rec.format).to eq ['Book']
|
42
39
|
end
|
43
|
-
it "'librettos'", :
|
40
|
+
it "'librettos'", jira: 'INDEX-98' do
|
44
41
|
m = "<mods #{@ns_decl}><genre>librettos</genre><typeOfResource>text</typeOfResource></mods>"
|
45
42
|
@smods_rec.from_str(m)
|
46
43
|
expect(@smods_rec.format).to eq ['Book']
|
@@ -48,12 +45,12 @@ describe "Format fields (searchworks.rb)" do
|
|
48
45
|
@smods_rec.from_str(m)
|
49
46
|
expect(@smods_rec.format).to eq ['Book']
|
50
47
|
end
|
51
|
-
it "'libretto' isn't valid", :
|
48
|
+
it "'libretto' isn't valid", jira: 'INDEX-98' do
|
52
49
|
m = "<mods #{@ns_decl}><genre>libretto</genre><typeOfResource>text</typeOfResource></mods>"
|
53
50
|
@smods_rec.from_str(m)
|
54
51
|
expect(@smods_rec.format).to eq []
|
55
52
|
end
|
56
|
-
it "'project report'", :
|
53
|
+
it "'project report'", jira: 'GRYP-170', github: 'gdor-indexer/#7' do
|
57
54
|
m = "<mods #{@ns_decl}><genre>project report</genre><typeOfResource>text</typeOfResource></mods>"
|
58
55
|
@smods_rec.from_str(m)
|
59
56
|
expect(@smods_rec.format).to eq ['Book']
|
@@ -64,12 +61,12 @@ describe "Format fields (searchworks.rb)" do
|
|
64
61
|
@smods_rec.from_str(m)
|
65
62
|
expect(@smods_rec.format).to eq ['Book']
|
66
63
|
end
|
67
|
-
it "'report' isn't valid", :
|
64
|
+
it "'report' isn't valid", jira: 'GRYP-170', github: 'gdor-indexer/#7' do
|
68
65
|
m = "<mods #{@ns_decl}><genre>report</genre><typeOfResource>text</typeOfResource></mods>"
|
69
66
|
@smods_rec.from_str(m)
|
70
67
|
expect(@smods_rec.format).to eq []
|
71
68
|
end
|
72
|
-
it "'technical report'", :
|
69
|
+
it "'technical report'", jira: 'GRYPHONDOR-207' do
|
73
70
|
m = "<mods #{@ns_decl}><genre>technical report</genre><typeOfResource>text</typeOfResource></mods>"
|
74
71
|
@smods_rec.from_str(m)
|
75
72
|
expect(@smods_rec.format).to eq ['Book']
|
@@ -80,7 +77,7 @@ describe "Format fields (searchworks.rb)" do
|
|
80
77
|
@smods_rec.from_str(m)
|
81
78
|
expect(@smods_rec.format).to eq ['Book']
|
82
79
|
end
|
83
|
-
it "'working paper'", :
|
80
|
+
it "'working paper'", email: 'mods-squad 2014-05-22, Joanna Dyla' do
|
84
81
|
m = "<mods #{@ns_decl}><genre>working paper</genre><typeOfResource>text</typeOfResource></mods>"
|
85
82
|
@smods_rec.from_str(m)
|
86
83
|
expect(@smods_rec.format).to eq ['Book']
|
@@ -101,7 +98,7 @@ describe "Format fields (searchworks.rb)" do
|
|
101
98
|
@smods_rec.from_str(m)
|
102
99
|
expect(@smods_rec.format).to eq ['Computer File']
|
103
100
|
end
|
104
|
-
it "genre 'game'", :
|
101
|
+
it "genre 'game'", jira: 'GRYPHONDOR-207' do
|
105
102
|
m = "<mods #{@ns_decl}><genre>game</genre><typeOfResource>software, multimedia</typeOfResource></mods>"
|
106
103
|
@smods_rec.from_str(m)
|
107
104
|
expect(@smods_rec.format).to eq ['Computer File']
|
@@ -111,7 +108,7 @@ describe "Format fields (searchworks.rb)" do
|
|
111
108
|
end
|
112
109
|
end
|
113
110
|
|
114
|
-
it "Conference Proceedings: typeOfResource 'text', genre 'conference publication'", :
|
111
|
+
it "Conference Proceedings: typeOfResource 'text', genre 'conference publication'", jira: 'GRYPHONDOR-207' do
|
115
112
|
m = "<mods #{@ns_decl}><genre>conference publication</genre><typeOfResource>text</typeOfResource></mods>"
|
116
113
|
@smods_rec.from_str(m)
|
117
114
|
expect(@smods_rec.format).to eq ['Conference Proceedings']
|
@@ -157,7 +154,7 @@ describe "Format fields (searchworks.rb)" do
|
|
157
154
|
expect(@smods_rec.format).to eq ['Map/Globe']
|
158
155
|
end
|
159
156
|
|
160
|
-
it "Music - Recording: typeOfResource 'sound recording-musical'", :
|
157
|
+
it "Music - Recording: typeOfResource 'sound recording-musical'", jira: 'GRYPHONDOR-207' do
|
161
158
|
m = "<mods #{@ns_decl}><typeOfResource>sound recording-musical</typeOfResource></mods>"
|
162
159
|
@smods_rec.from_str(m)
|
163
160
|
expect(@smods_rec.format).to eq ['Music - Recording']
|
@@ -169,7 +166,7 @@ describe "Format fields (searchworks.rb)" do
|
|
169
166
|
expect(@smods_rec.format).to eq ['Music - Score']
|
170
167
|
end
|
171
168
|
|
172
|
-
it "Other: typeOfResource 'text', genre 'student project report'", :
|
169
|
+
it "Other: typeOfResource 'text', genre 'student project report'", email: 'from Vitus, August 16, 2013' do
|
173
170
|
m = "<mods #{@ns_decl}><genre>student project report</genre><typeOfResource>text</typeOfResource></mods>"
|
174
171
|
@smods_rec.from_str(m)
|
175
172
|
expect(@smods_rec.format).to eq ['Other']
|
@@ -185,7 +182,7 @@ describe "Format fields (searchworks.rb)" do
|
|
185
182
|
end
|
186
183
|
|
187
184
|
context "Sound Recording:" do
|
188
|
-
it "typeOfResource 'sound recording-nonmusical', genre 'sound", :
|
185
|
+
it "typeOfResource 'sound recording-nonmusical', genre 'sound", jira: 'GRYPHONDOR-207' do
|
189
186
|
m = "<mods #{@ns_decl}><genre>sound</genre><typeOfResource>sound recording-nonmusical</typeOfResource></mods>"
|
190
187
|
@smods_rec.from_str(m)
|
191
188
|
expect(@smods_rec.format).to eq ['Sound Recording']
|
@@ -193,7 +190,7 @@ describe "Format fields (searchworks.rb)" do
|
|
193
190
|
@smods_rec.from_str(m)
|
194
191
|
expect(@smods_rec.format).to eq ['Sound Recording']
|
195
192
|
end
|
196
|
-
it "typeOfResource 'sound recording', genre 'sound", :
|
193
|
+
it "typeOfResource 'sound recording', genre 'sound", jira: 'INDEX-94' do
|
197
194
|
m = "<mods #{@ns_decl}><genre>sound</genre><typeOfResource>sound recording</typeOfResource></mods>"
|
198
195
|
@smods_rec.from_str(m)
|
199
196
|
expect(@smods_rec.format).to eq ['Sound Recording']
|
@@ -218,7 +215,7 @@ describe "Format fields (searchworks.rb)" do
|
|
218
215
|
@smods_rec.from_str(m)
|
219
216
|
expect(@smods_rec.format).to eq ['Video']
|
220
217
|
end
|
221
|
-
it "genre 'motion picture'", :
|
218
|
+
it "genre 'motion picture'", jira: 'GRYPHONDOR-207' do
|
222
219
|
m = "<mods #{@ns_decl}><genre>motion picture</genre><typeOfResource>moving image</typeOfResource></mods>"
|
223
220
|
@smods_rec.from_str(m)
|
224
221
|
expect(@smods_rec.format).to eq ['Video']
|
@@ -231,7 +228,7 @@ describe "Format fields (searchworks.rb)" do
|
|
231
228
|
end
|
232
229
|
end
|
233
230
|
|
234
|
-
context "multiple format values", :
|
231
|
+
context "multiple format values", jira: 'INDEX-32' do
|
235
232
|
it "multiple typeOfResource elements" do
|
236
233
|
m = "<mods #{@ns_decl}><typeOfResource>moving image</typeOfResource><typeOfResource>sound recording</typeOfResource></mods>"
|
237
234
|
@smods_rec.from_str(m)
|
@@ -299,7 +296,7 @@ describe "Format fields (searchworks.rb)" do
|
|
299
296
|
@smods_rec.from_str(m)
|
300
297
|
expect(@smods_rec.format_main).to eq ['Book']
|
301
298
|
end
|
302
|
-
it "'book chapter'", :
|
299
|
+
it "'book chapter'", email: 'mods-squad 2014-05-22, Joanna Dyla' do
|
303
300
|
m = "<mods #{@ns_decl}><genre authority=\"local\">book chapter</genre><typeOfResource>text</typeOfResource></mods>"
|
304
301
|
@smods_rec.from_str(m)
|
305
302
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -310,7 +307,7 @@ describe "Format fields (searchworks.rb)" do
|
|
310
307
|
@smods_rec.from_str(m)
|
311
308
|
expect(@smods_rec.format_main).to eq ['Book']
|
312
309
|
end
|
313
|
-
it "'issue brief'", :
|
310
|
+
it "'issue brief'", email: 'mods-squad 2014-05-22, Joanna Dyla' do
|
314
311
|
m = "<mods #{@ns_decl}><genre authority=\"local\">issue brief</genre><typeOfResource>text</typeOfResource></mods>"
|
315
312
|
@smods_rec.from_str(m)
|
316
313
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -321,7 +318,7 @@ describe "Format fields (searchworks.rb)" do
|
|
321
318
|
@smods_rec.from_str(m)
|
322
319
|
expect(@smods_rec.format_main).to eq ['Book']
|
323
320
|
end
|
324
|
-
it "'project report'", :
|
321
|
+
it "'project report'", jira: 'GRYP-170', github: 'gdor-indexer/#7' do
|
325
322
|
m = "<mods #{@ns_decl}><genre>project report</genre><typeOfResource>text</typeOfResource></mods>"
|
326
323
|
@smods_rec.from_str(m)
|
327
324
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -332,12 +329,12 @@ describe "Format fields (searchworks.rb)" do
|
|
332
329
|
@smods_rec.from_str(m)
|
333
330
|
expect(@smods_rec.format_main).to eq ['Book']
|
334
331
|
end
|
335
|
-
it "'report' isn't valid", :
|
332
|
+
it "'report' isn't valid", jira: 'GRYP-170', github: 'gdor-indexer/#7' do
|
336
333
|
m = "<mods #{@ns_decl}><genre>report</genre><typeOfResource>text</typeOfResource></mods>"
|
337
334
|
@smods_rec.from_str(m)
|
338
335
|
expect(@smods_rec.format_main).to eq []
|
339
336
|
end
|
340
|
-
it "'student project report'", :
|
337
|
+
it "'student project report'", consul: '/NGDE/Format 2014-05-28' do
|
341
338
|
m = "<mods #{@ns_decl}><genre authority=\"local\">student project report</genre><typeOfResource>text</typeOfResource></mods>"
|
342
339
|
@smods_rec.from_str(m)
|
343
340
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -351,7 +348,7 @@ describe "Format fields (searchworks.rb)" do
|
|
351
348
|
@smods_rec.from_str(m)
|
352
349
|
expect(@smods_rec.format_main).to eq ['Book']
|
353
350
|
end
|
354
|
-
it "'technical report'", :
|
351
|
+
it "'technical report'", jira: 'GRYPHONDOR-207' do
|
355
352
|
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">technical report</genre><typeOfResource>text</typeOfResource></mods>"
|
356
353
|
@smods_rec.from_str(m)
|
357
354
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -362,7 +359,7 @@ describe "Format fields (searchworks.rb)" do
|
|
362
359
|
@smods_rec.from_str(m)
|
363
360
|
expect(@smods_rec.format_main).to eq ['Book']
|
364
361
|
end
|
365
|
-
it "'working paper'", :
|
362
|
+
it "'working paper'", email: 'mods-squad 2014-05-22, Joanna Dyla' do
|
366
363
|
m = "<mods #{@ns_decl}><genre authority=\"local\">working paper</genre><typeOfResource>text</typeOfResource></mods>"
|
367
364
|
@smods_rec.from_str(m)
|
368
365
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -383,7 +380,7 @@ describe "Format fields (searchworks.rb)" do
|
|
383
380
|
expect(@smods_rec.format_main).to eq ['Book']
|
384
381
|
end
|
385
382
|
context "genre" do
|
386
|
-
it "'conference publication'", :
|
383
|
+
it "'conference publication'", jira: 'GRYPHONDOR-207' do
|
387
384
|
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">conference publication</genre><typeOfResource>text</typeOfResource></mods>"
|
388
385
|
@smods_rec.from_str(m)
|
389
386
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -394,7 +391,7 @@ describe "Format fields (searchworks.rb)" do
|
|
394
391
|
@smods_rec.from_str(m)
|
395
392
|
expect(@smods_rec.format_main).to eq ['Book']
|
396
393
|
end
|
397
|
-
it "'instruction'", :
|
394
|
+
it "'instruction'", consul: '/NGDE/Format 2014-05-28' do
|
398
395
|
# Hydrus 'textbook'
|
399
396
|
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">instruction</genre><typeOfResource>text</typeOfResource></mods>"
|
400
397
|
@smods_rec.from_str(m)
|
@@ -403,12 +400,12 @@ describe "Format fields (searchworks.rb)" do
|
|
403
400
|
@smods_rec.from_str(m)
|
404
401
|
expect(@smods_rec.format_main).to eq ['Book']
|
405
402
|
end
|
406
|
-
it "'libretto' isn't valid", :
|
403
|
+
it "'libretto' isn't valid", jira: 'INDEX-98' do
|
407
404
|
m = "<mods #{@ns_decl}><genre>libretto</genre><typeOfResource>text</typeOfResource></mods>"
|
408
405
|
@smods_rec.from_str(m)
|
409
406
|
expect(@smods_rec.format_main).to eq []
|
410
407
|
end
|
411
|
-
it "'librettos'", :
|
408
|
+
it "'librettos'", jira: 'INDEX-98' do
|
412
409
|
m = "<mods #{@ns_decl}><genre>librettos</genre><typeOfResource>text</typeOfResource></mods>"
|
413
410
|
@smods_rec.from_str(m)
|
414
411
|
expect(@smods_rec.format_main).to eq ['Book']
|
@@ -457,7 +454,7 @@ describe "Format fields (searchworks.rb)" do
|
|
457
454
|
expect(@smods_rec.format_main).to eq ['Map']
|
458
455
|
end
|
459
456
|
|
460
|
-
context "Music - Recording: typeOfResource 'sound recording-musical'", :
|
457
|
+
context "Music - Recording: typeOfResource 'sound recording-musical'", jira: 'GRYPHONDOR-207' do
|
461
458
|
it "no genre" do
|
462
459
|
m = "<mods #{@ns_decl}><typeOfResource>sound recording-musical</typeOfResource></mods>"
|
463
460
|
@smods_rec.from_str(m)
|
@@ -485,7 +482,7 @@ describe "Format fields (searchworks.rb)" do
|
|
485
482
|
@smods_rec.from_str(m)
|
486
483
|
expect(@smods_rec.format_main).to eq ['Software/Multimedia']
|
487
484
|
end
|
488
|
-
it "genre 'game'", :
|
485
|
+
it "genre 'game'", jira: 'GRYPHONDOR-207' do
|
489
486
|
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">game</genre><typeOfResource>software, multimedia</typeOfResource></mods>"
|
490
487
|
@smods_rec.from_str(m)
|
491
488
|
expect(@smods_rec.format_main).to eq ['Software/Multimedia']
|
@@ -503,7 +500,7 @@ describe "Format fields (searchworks.rb)" do
|
|
503
500
|
end
|
504
501
|
|
505
502
|
context "Sound Recording:" do
|
506
|
-
it "typeOfResource 'sound recording-nonmusical', genre 'sound", :
|
503
|
+
it "typeOfResource 'sound recording-nonmusical', genre 'sound", jira: 'GRYPHONDOR-207' do
|
507
504
|
m = "<mods #{@ns_decl}><genre>sound</genre><typeOfResource>sound recording-nonmusical</typeOfResource></mods>"
|
508
505
|
@smods_rec.from_str(m)
|
509
506
|
expect(@smods_rec.format_main).to eq ['Sound recording']
|
@@ -511,7 +508,7 @@ describe "Format fields (searchworks.rb)" do
|
|
511
508
|
@smods_rec.from_str(m)
|
512
509
|
expect(@smods_rec.format_main).to eq ['Sound recording']
|
513
510
|
end
|
514
|
-
it "typeOfResource 'sound recording', genre 'sound", :
|
511
|
+
it "typeOfResource 'sound recording', genre 'sound", jira: 'INDEX-94' do
|
515
512
|
m = "<mods #{@ns_decl}><genre>sound</genre><typeOfResource>sound recording</typeOfResource></mods>"
|
516
513
|
@smods_rec.from_str(m)
|
517
514
|
expect(@smods_rec.format_main).to eq ['Sound recording']
|
@@ -521,14 +518,13 @@ describe "Format fields (searchworks.rb)" do
|
|
521
518
|
end
|
522
519
|
end
|
523
520
|
|
524
|
-
|
525
521
|
context "Video: typeOfResource 'moving image'" do
|
526
522
|
it "no genre" do
|
527
523
|
m = "<mods #{@ns_decl}><typeOfResource>moving image</typeOfResource></mods>"
|
528
524
|
@smods_rec.from_str(m)
|
529
525
|
expect(@smods_rec.format_main).to eq ['Video']
|
530
526
|
end
|
531
|
-
it "genre 'motion picture'", :
|
527
|
+
it "genre 'motion picture'", jira: 'GRYPHONDOR-207' do
|
532
528
|
m = "<mods #{@ns_decl}><genre>motion picture</genre><typeOfResource>moving image</typeOfResource></mods>"
|
533
529
|
@smods_rec.from_str(m)
|
534
530
|
expect(@smods_rec.format_main).to eq ['Video']
|
@@ -541,7 +537,7 @@ describe "Format fields (searchworks.rb)" do
|
|
541
537
|
end
|
542
538
|
end
|
543
539
|
|
544
|
-
context "multiple values", :
|
540
|
+
context "multiple values", jira: 'INDEX-32' do
|
545
541
|
it "multiple typeOfResource elements" do
|
546
542
|
m = "<mods #{@ns_decl}><typeOfResource>moving image</typeOfResource><typeOfResource>sound recording</typeOfResource></mods>"
|
547
543
|
@smods_rec.from_str(m)
|
@@ -579,7 +575,7 @@ describe "Format fields (searchworks.rb)" do
|
|
579
575
|
@smods_rec.from_str(m)
|
580
576
|
expect(@smods_rec.format_main).to eq []
|
581
577
|
end
|
582
|
-
end #format_main
|
578
|
+
end # format_main
|
583
579
|
|
584
580
|
context "sw_genre" do
|
585
581
|
it "ignores values that are not in the prescribed list" do
|
@@ -637,7 +633,7 @@ describe "Format fields (searchworks.rb)" do
|
|
637
633
|
it "it does not include Archived website: typeOfResource 'text', genre 'archived website'" do
|
638
634
|
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">archived website</genre><typeOfResource>text</typeOfResource></mods>"
|
639
635
|
@smods_rec.from_str(m)
|
640
|
-
expect(@smods_rec.sw_genre).
|
636
|
+
expect(@smods_rec.sw_genre).not_to eq ['Archived website']
|
641
637
|
end
|
642
638
|
it "capitalizes the first letter of a genre value" do
|
643
639
|
m = "<mods #{@ns_decl}><typeOfResource>text</typeOfResource><genre authority=\"marcgt\">technical report</genre></mods>"
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
2
|
describe "Date methods (searchworks.rb)" do
|
5
|
-
|
6
3
|
let(:ns_decl) { "xmlns='#{Mods::MODS_NS}'" }
|
7
4
|
let(:smods_rec) { Stanford::Mods::Record.new }
|
8
5
|
|
@@ -14,7 +11,6 @@ describe "Date methods (searchworks.rb)" do
|
|
14
11
|
# dateCreated: 4 digit year
|
15
12
|
# and they should go in spec/fixtures searchworks_pub_date_data.rb
|
16
13
|
|
17
|
-
|
18
14
|
# @deprecated: need to switch to pub_year_int, or pub_date_sortable_string if you must have a string (why?)
|
19
15
|
context '#pub_date_sort (deprecated)' do
|
20
16
|
it 'four digits' do
|
@@ -228,5 +224,4 @@ describe "Date methods (searchworks.rb)" do
|
|
228
224
|
expect(smods_rec.send(:pub_dates)).to eq(['1906', '1904', '1904'])
|
229
225
|
end
|
230
226
|
end
|
231
|
-
|
232
227
|
end
|
data/spec/searchworks_spec.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
2
|
describe "Searchworks mixin for Stanford::Mods::Record" do
|
5
|
-
|
6
3
|
before(:all) do
|
7
4
|
@smods_rec = Stanford::Mods::Record.new
|
8
5
|
@ns_decl = "xmlns='#{Mods::MODS_NS}'"
|
@@ -14,9 +11,7 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
|
|
14
11
|
@smods_rec.from_str m
|
15
12
|
langs = @smods_rec.sw_language_facet
|
16
13
|
expect(langs.size).to eq(3)
|
17
|
-
expect(langs).to include("Persian")
|
18
|
-
expect(langs).to include("Arabic")
|
19
|
-
expect(langs).to include("Dutch")
|
14
|
+
expect(langs).to include("Persian", "Arabic", "Dutch")
|
20
15
|
expect(langs).not_to include("Dutch; Flemish")
|
21
16
|
end
|
22
17
|
it "should not have duplicates" do
|
@@ -109,5 +104,4 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
|
|
109
104
|
end
|
110
105
|
end
|
111
106
|
end # context sw author methods
|
112
|
-
|
113
107
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
2
|
describe "Searchworks mixin for Stanford::Mods::Record" do
|
5
|
-
|
6
3
|
before(:all) do
|
7
4
|
@smods_rec = Stanford::Mods::Record.new
|
8
5
|
@ns_decl = "xmlns='#{Mods::MODS_NS}'"
|
@@ -219,7 +216,6 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
|
|
219
216
|
end
|
220
217
|
end # sw_subject_titles
|
221
218
|
|
222
|
-
|
223
219
|
context "sw_geographic_search" do
|
224
220
|
it "should contain subject <geographic> subelement data" do
|
225
221
|
expect(@sw_geographic_search).to include(@geo)
|
@@ -380,5 +376,4 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
|
|
380
376
|
end
|
381
377
|
end # sw_geographic_search
|
382
378
|
end # context sw subject methods
|
383
|
-
|
384
379
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
2
|
describe "Subject fields (searchworks.rb)" do
|
5
|
-
|
6
3
|
before(:all) do
|
7
4
|
@ns_decl = "xmlns='#{Mods::MODS_NS}'"
|
8
5
|
@genre = 'genre top level'
|
@@ -284,7 +281,7 @@ describe "Subject fields (searchworks.rb)" do
|
|
284
281
|
expect(@smods_rec.subject_all_search).to be_nil
|
285
282
|
end
|
286
283
|
it "should contain top level <genre> element data" do
|
287
|
-
|
284
|
+
expect(@smods_rec.subject_all_search).to include(@genre)
|
288
285
|
end
|
289
286
|
it "should not contain cartographic sub element" do
|
290
287
|
expect(@smods_rec.subject_all_search).not_to include(@cart_coord)
|
@@ -307,11 +304,9 @@ describe "Subject fields (searchworks.rb)" do
|
|
307
304
|
expect(@smods_rec.subject_all_search).to include(@topic)
|
308
305
|
end
|
309
306
|
end # subject_all_search
|
310
|
-
|
311
|
-
end # search fields
|
307
|
+
end # search fields
|
312
308
|
|
313
309
|
context "facet fields" do
|
314
|
-
|
315
310
|
context "topic_facet" do
|
316
311
|
it "should include topic subelement" do
|
317
312
|
expect(@smods_rec.topic_facet).to include(@topic)
|
@@ -394,7 +389,5 @@ describe "Subject fields (searchworks.rb)" do
|
|
394
389
|
expect(@smods_rec.era_facet).to be_nil
|
395
390
|
end
|
396
391
|
end
|
397
|
-
|
398
392
|
end # facet fields
|
399
|
-
|
400
393
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -13,9 +13,6 @@ RSpec.configure do |config|
|
|
13
13
|
mocks.verify_partial_doubles = true
|
14
14
|
end
|
15
15
|
|
16
|
-
if config.files_to_run.one?
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
#config.order = :random
|
16
|
+
config.default_formatter = 'doc' if config.files_to_run.one?
|
17
|
+
# config.order = :random
|
21
18
|
end
|