pennmarc 0.0.2 → 1.0.1

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.rubocop_todo.yml +143 -0
  4. data/Gemfile +1 -1
  5. data/README.md +12 -2
  6. data/lib/pennmarc/helpers/creator.rb +59 -21
  7. data/lib/pennmarc/helpers/database.rb +8 -8
  8. data/lib/pennmarc/helpers/date.rb +16 -15
  9. data/lib/pennmarc/helpers/edition.rb +25 -20
  10. data/lib/pennmarc/helpers/format.rb +15 -4
  11. data/lib/pennmarc/helpers/genre.rb +13 -11
  12. data/lib/pennmarc/helpers/helper.rb +1 -0
  13. data/lib/pennmarc/helpers/identifier.rb +16 -7
  14. data/lib/pennmarc/helpers/language.rb +3 -3
  15. data/lib/pennmarc/helpers/link.rb +6 -0
  16. data/lib/pennmarc/helpers/location.rb +8 -8
  17. data/lib/pennmarc/helpers/note.rb +52 -2
  18. data/lib/pennmarc/helpers/relation.rb +4 -4
  19. data/lib/pennmarc/helpers/series.rb +171 -85
  20. data/lib/pennmarc/helpers/subject.rb +16 -17
  21. data/lib/pennmarc/helpers/title.rb +1 -1
  22. data/lib/pennmarc/mappers.rb +31 -0
  23. data/lib/pennmarc/parser.rb +34 -157
  24. data/lib/pennmarc/util.rb +15 -16
  25. data/pennmarc.gemspec +2 -2
  26. data/spec/lib/pennmarc/helpers/citation_spec.rb +1 -2
  27. data/spec/lib/pennmarc/helpers/creator_spec.rb +54 -19
  28. data/spec/lib/pennmarc/helpers/date_spec.rb +5 -5
  29. data/spec/lib/pennmarc/helpers/edition_spec.rb +4 -6
  30. data/spec/lib/pennmarc/helpers/format_spec.rb +30 -10
  31. data/spec/lib/pennmarc/helpers/genre_spec.rb +4 -4
  32. data/spec/lib/pennmarc/helpers/identifer_spec.rb +15 -0
  33. data/spec/lib/pennmarc/helpers/language_spec.rb +1 -1
  34. data/spec/lib/pennmarc/helpers/location_spec.rb +2 -1
  35. data/spec/lib/pennmarc/helpers/note_spec.rb +67 -2
  36. data/spec/lib/pennmarc/helpers/relation_spec.rb +2 -2
  37. data/spec/lib/pennmarc/helpers/series_spec.rb +54 -0
  38. data/spec/lib/pennmarc/helpers/subject_spec.rb +9 -9
  39. data/spec/lib/pennmarc/helpers/title_spec.rb +3 -1
  40. data/spec/lib/pennmarc/marc_util_spec.rb +9 -8
  41. data/spec/lib/pennmarc/parser_spec.rb +24 -3
  42. data/spec/spec_helper.rb +1 -1
  43. metadata +8 -20
  44. data/legacy/indexer.rb +0 -568
  45. data/legacy/marc.rb +0 -2964
  46. data/legacy/test_file_output.json +0 -49
@@ -9,7 +9,7 @@ describe 'PennMARC::Creator' do
9
9
  describe '.search' do
10
10
  let(:record) { marc_record fields: fields }
11
11
 
12
- context 'for a single author record' do
12
+ context 'with a single author record' do
13
13
  let(:fields) do
14
14
  [marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345',
15
15
  e: 'author', d: '1900-2000' }),
@@ -17,21 +17,21 @@ describe 'PennMARC::Creator' do
17
17
  end
18
18
 
19
19
  it 'contains the expected search field values for a single author work' do
20
- expect(helper.search(record, mapping)).to eq ['Name Surname http://cool.uri/12345 author 1900-2000.',
21
- 'Surname, Name http://cool.uri/12345 author 1900-2000.',
22
- 'Alternative Surname']
20
+ expect(helper.search(record, relator_map: mapping)).to eq ['Name Surname http://cool.uri/12345 author 1900-2000.',
21
+ 'Surname, Name http://cool.uri/12345 author 1900-2000.',
22
+ 'Alternative Surname']
23
23
  end
24
24
  end
25
25
 
26
- context 'for a corporate author record' do
26
+ context 'with a corporate author record' do
27
27
  let(:fields) do
28
28
  [marc_field(tag: '110', subfields: { a: 'Group of People', b: 'Annual Meeting', '4': 'aut' }),
29
29
  marc_field(tag: '880', subfields: { '6': '110', a: 'Alt. Group Name', b: 'Alt. Annual Meeting' })]
30
30
  end
31
31
 
32
32
  it 'contains the expected search field values for a corporate author work' do
33
- expect(helper.search(record, mapping)).to eq ['Group of People Annual Meeting Author.',
34
- 'Alt. Group Name Alt. Annual Meeting']
33
+ expect(helper.search(record, relator_map: mapping)).to eq ['Group of People Annual Meeting Author.',
34
+ 'Alt. Group Name Alt. Annual Meeting']
35
35
  end
36
36
  end
37
37
  end
@@ -39,26 +39,26 @@ describe 'PennMARC::Creator' do
39
39
  describe '.values' do
40
40
  let(:record) { marc_record fields: fields }
41
41
 
42
- context 'for a single author record' do
42
+ context 'with a single author record' do
43
43
  let(:fields) do
44
44
  [marc_field(tag: '100', subfields: { a: 'Author', c: 'Fancy', d: 'active 24th century AD', '4': 'aut' }),
45
45
  marc_field(tag: '880', subfields: { '6': '100', a: 'Alt Author', c: 'Alt Fanciness' })]
46
46
  end
47
47
 
48
48
  it 'returns values for the author, including mapped relator code from ǂ4' do
49
- values = helper.values(record, mapping)
49
+ values = helper.values(record, relator_map: mapping)
50
50
  expect(values).to contain_exactly 'Author Fancy active 24th century AD, Author.'
51
51
  expect(values.join.downcase).not_to include 'alt'
52
52
  end
53
53
  end
54
54
 
55
- context 'for a corporate author record' do
55
+ context 'with a corporate author record' do
56
56
  let(:fields) do
57
57
  [marc_field(tag: '110', subfields: { a: 'Annual Report', b: 'Leader', e: 'author', '4': 'aut' })]
58
58
  end
59
59
 
60
60
  it 'returns values for the corporate author, including mapped relator code from ǂ4' do
61
- expect(helper.values(record, mapping)).to contain_exactly 'Annual Report Leader author, Author.'
61
+ expect(helper.values(record, relator_map: mapping)).to contain_exactly 'Annual Report Leader author, Author.'
62
62
  end
63
63
  end
64
64
  end
@@ -66,12 +66,13 @@ describe 'PennMARC::Creator' do
66
66
  describe '.show' do
67
67
  let(:record) { marc_record fields: fields }
68
68
 
69
- context 'for a single author record' do
69
+ context 'with a single author record' do
70
70
  let(:fields) do
71
71
  [marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
72
72
  e: 'author', '4': 'http://cool.uri/vocabulary/relators/aut' }),
73
73
  marc_field(tag: '880', subfields: { a: 'Surname, Alternative', '6': '100' })]
74
74
  end
75
+
75
76
  it 'returns single author values with no URIs anywhere' do
76
77
  values = helper.show(record)
77
78
  expect(values).to contain_exactly 'Surname, Name 1900-2000', 'Surname, Alternative'
@@ -79,11 +80,12 @@ describe 'PennMARC::Creator' do
79
80
  end
80
81
  end
81
82
 
82
- context 'for a corporate author record' do
83
+ context 'with a corporate author record' do
83
84
  let(:fields) do
84
85
  [marc_field(tag: '110', subfields: { a: 'Group of People', b: 'Annual Meeting', '4': 'aut' }),
85
86
  marc_field(tag: '880', subfields: { '6': '110', a: 'Alt. Group Name', b: 'Alt. Annual Meeting' })]
86
87
  end
88
+
87
89
  it 'returns corporate author values with no URIs anywhere' do
88
90
  values = helper.show(record)
89
91
  expect(values).to contain_exactly 'Alt. Group Name Alt. Annual Meeting', 'Group of People Annual Meeting'
@@ -110,7 +112,7 @@ describe 'PennMARC::Creator' do
110
112
  let(:record) { marc_record fields: fields }
111
113
  let(:values) { helper.facet(record) }
112
114
 
113
- context 'for a single author record' do
115
+ context 'with a single author record' do
114
116
  let(:fields) do
115
117
  [marc_field(tag: '100', subfields: { a: 'Author, Great', d: '1900-2000' }),
116
118
  marc_field(tag: '700', subfields: { a: 'Co-Author, Great', d: '1900-2000' }),
@@ -121,7 +123,8 @@ describe 'PennMARC::Creator' do
121
123
  expect(values).to contain_exactly 'Author, Added', 'Author, Great 1900-2000', 'Co-Author, Great 1900-2000'
122
124
  end
123
125
  end
124
- context 'for a corporate author record' do
126
+
127
+ context 'with a corporate author record' do
125
128
  let(:fields) do
126
129
  [marc_field(tag: '110', subfields: { a: 'Group of People', b: 'Annual Meeting' }),
127
130
  marc_field(tag: '710', subfields: { a: 'A Publisher', e: 'publisher' }),
@@ -134,7 +137,8 @@ describe 'PennMARC::Creator' do
134
137
  'Group of People Annual Meeting'
135
138
  end
136
139
  end
137
- context 'for a meeting author record' do
140
+
141
+ context 'with a meeting author record' do
138
142
  let(:fields) do
139
143
  [marc_field(tag: '111', subfields: { a: 'Conference on Things', c: 'Earth' }),
140
144
  marc_field(tag: '711', subfields: { a: 'Thing Institute', j: 'sponsoring body' }),
@@ -156,7 +160,7 @@ describe 'PennMARC::Creator' do
156
160
  end
157
161
 
158
162
  it 'returns conference name information for display, ignoring any linked 880 fields' do
159
- expect(helper.conference_show(record, mapping)).to eq ['MARC History Symposium, Author.']
163
+ expect(helper.conference_show(record, relator_map: mapping)).to eq ['MARC History Symposium, Author.']
160
164
  end
161
165
  end
162
166
 
@@ -178,6 +182,37 @@ describe 'PennMARC::Creator' do
178
182
  end
179
183
  end
180
184
 
181
- xdescribe '.conference_search'
182
- xdescribe '.search_aux'
185
+ describe '.contributor_show' do
186
+ let(:record) do
187
+ marc_record fields: [
188
+ marc_field(tag: '700', subfields: { a: 'Name', b: 'I', c: 'laureate', d: '1968', e: 'author',
189
+ j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
190
+ '4': 'aut' }),
191
+ marc_field(tag: '700', subfields: { a: 'Ignore' }, indicator2: '1'),
192
+ marc_field(tag: '700', subfields: { i: 'Ignore' }),
193
+ marc_field(tag: '710', subfields: { a: 'Corporation', b: 'A division', c: 'Office', d: '1968', e: 'author',
194
+ u: 'affiliation', '3': 'materials',
195
+ '4': 'aut' }),
196
+ marc_field(tag: '880', subfields: { '6': '700', a: 'Alt Name', b: 'Alt num', c: 'Alt title',
197
+ d: 'Alt date', e: 'Alt relator', j: 'Alt qualifier', q: 'Alt Fuller Name',
198
+ u: 'Alt affiliation', '3': 'Alt materials' }),
199
+ marc_field(tag: '880', subfields: { '6': '710', a: 'Alt Corp Name', b: 'Alt unit', c: 'Alt location',
200
+ d: 'Alt date', e: 'Alt relator', u: 'Alt Affiliation',
201
+ '3': 'Alt materials' }),
202
+ marc_field(tag: '880', subfields: { i: 'Ignore', '6': '700' })
203
+ ]
204
+ end
205
+
206
+ it 'returns expected contributor values' do
207
+ expect(helper.contributor_show(record, relator_map: mapping)).to contain_exactly(
208
+ 'Name I laureate 1968 pseud Fuller Name author affiliation materials, Author',
209
+ 'Corporation A division Office 1968 author affiliation materials, Author',
210
+ 'Alt Name Alt num Alt title Alt date Alt qualifier Alt Fuller Name Alt relator Alt affiliation Alt materials',
211
+ 'Alt Corp Name Alt unit Alt location Alt date Alt relator Alt Affiliation Alt materials'
212
+ )
213
+ end
214
+ end
215
+
216
+ # describe '.conference_search'
217
+ # describe '.search_aux'
183
218
  end
@@ -27,7 +27,7 @@ describe 'PennMARC::Date' do
27
27
  end
28
28
 
29
29
  describe '.added' do
30
- context "with date formatted '%Y-%m-%d' " do
30
+ context "with date formatted '%Y-%m-%d'" do
31
31
  let(:fields) { [marc_field(tag: 'itm', subfields: { q: '2023-06-28' })] }
32
32
 
33
33
  it 'returns expected value' do
@@ -70,9 +70,9 @@ describe 'PennMARC::Date' do
70
70
  end
71
71
 
72
72
  it 'outputs error message' do
73
- expect do
73
+ expect {
74
74
  helper.added(record)
75
- end.to output("Error parsing date in date added subfield: invalid date - invalid date\n").to_stdout
75
+ }.to output("Error parsing date in date added subfield: invalid date - invalid date\n").to_stdout
76
76
  end
77
77
  end
78
78
  end
@@ -96,9 +96,9 @@ describe 'PennMARC::Date' do
96
96
  end
97
97
 
98
98
  it 'outputs error message' do
99
- expect do
99
+ expect {
100
100
  helper.last_updated(record)
101
- end.to output("Error parsing last updated date: invalid date - invalid date\n").to_stdout
101
+ }.to output("Error parsing last updated date: invalid date - invalid date\n").to_stdout
102
102
  end
103
103
  end
104
104
  end
@@ -10,7 +10,7 @@ describe 'PennMARC::Edition' do
10
10
  marc_field(tag: '880', subfields: { '6': '250', b: 'رمستر' }),
11
11
  marc_field(tag: '775', subfields: { i: 'Other Edition (Remove)',
12
12
  h: 'Cool Book',
13
- t: 'aut'}),
13
+ t: 'aut' }),
14
14
  marc_field(tag: '880', subfields: { '6': '775', i: 'Autre Editione' })]
15
15
  end
16
16
 
@@ -28,11 +28,9 @@ describe 'PennMARC::Edition' do
28
28
 
29
29
  describe '.other_show' do
30
30
  it 'returns other edition values' do
31
- expect(helper.other_show(record, mapping)).to contain_exactly('Autre Editione',
32
- 'Other Edition: Author. (Cool Book)')
31
+ expect(helper.other_show(record, relator_map: mapping)).to(
32
+ contain_exactly('Autre Editione', 'Other Edition: Author. (Cool Book)')
33
+ )
33
34
  end
34
35
  end
35
36
  end
36
-
37
-
38
-
@@ -7,9 +7,9 @@ describe 'PennMARC::Format' do
7
7
 
8
8
  describe '.facet' do
9
9
  let(:map) { location_map }
10
- let(:formats) { helper.facet(record, map) }
10
+ let(:formats) { helper.facet(record, location_map: map) }
11
11
 
12
- context 'for an "Archive"' do
12
+ context 'with an "Archive"' do
13
13
  let(:map) do
14
14
  { musearch: { specific_location: 'Penn Museum Archives',
15
15
  library: 'Penn Museum Archives',
@@ -19,7 +19,7 @@ describe 'PennMARC::Format' do
19
19
  display: 'Barbara Bates Center for History of Nursing - Fagin Hall 2U' } }
20
20
  end
21
21
 
22
- context 'for a record in "Penn Museum Archives (musearch)"' do
22
+ context 'with a record in "Penn Museum Archives (musearch)"' do
23
23
  let(:record) { marc_record fields: [marc_field(tag: 'hld', subfields: { c: 'musearch' })] }
24
24
 
25
25
  it 'returns format values of "Archive" for a record with holdings located in "musearch"' do
@@ -27,7 +27,7 @@ describe 'PennMARC::Format' do
27
27
  end
28
28
  end
29
29
 
30
- context 'for a record in "Nursing Archives (nursarch)"' do
30
+ context 'with a record in "Nursing Archives (nursarch)"' do
31
31
  let(:record) { marc_record fields: [marc_field(tag: 'hld', subfields: { c: 'nursarch' })] }
32
32
 
33
33
  it 'returns format values of without "Archive" for a record with a holding in "nursarch"' do
@@ -36,7 +36,7 @@ describe 'PennMARC::Format' do
36
36
  end
37
37
  end
38
38
 
39
- context 'for a "Newspaper"' do
39
+ context 'with a "Newspaper"' do
40
40
  let(:record) do
41
41
  marc_record leader: ' as',
42
42
  fields: [marc_control_field(tag: '008', value: ' n')]
@@ -50,7 +50,7 @@ describe 'PennMARC::Format' do
50
50
  # TODO: confirm this as desired functionality
51
51
  # Inspired by https://franklin.library.upenn.edu/catalog/FRANKLIN_999444703503681
52
52
  # which appears to be a thesis on microfilm, but only has microfilm as a format.
53
- context 'for a "Thesis" on "Microfilm"' do
53
+ context 'with a "Thesis" on "Microfilm"' do
54
54
  let(:record) do
55
55
  marc_record leader: ' tm',
56
56
  fields: [
@@ -65,7 +65,7 @@ describe 'PennMARC::Format' do
65
65
  end
66
66
  end
67
67
 
68
- context 'for Microformats as determined by the holding call numbers' do
68
+ context 'with Microformats as determined by the holding call numbers' do
69
69
  let(:record) do
70
70
  marc_record fields: [marc_field(tag: 'hld', subfields: { h: 'AB123', i: '.456 Microfilm' })]
71
71
  end
@@ -75,7 +75,7 @@ describe 'PennMARC::Format' do
75
75
  end
76
76
  end
77
77
 
78
- context 'for a "Book"' do
78
+ context 'with a "Book"' do
79
79
  let(:record) do
80
80
  marc_record leader: ' aa',
81
81
  fields: [marc_field(tag: '245', subfields: { k: 'blah' })]
@@ -86,7 +86,7 @@ describe 'PennMARC::Format' do
86
86
  end
87
87
  end
88
88
 
89
- context 'for a "Projected Graphic"' do
89
+ context 'with a "Projected Graphic"' do
90
90
  let(:record) do
91
91
  marc_record leader: ' gm',
92
92
  fields: [marc_control_field(tag: '007', value: 'go hkaaa ')]
@@ -180,8 +180,28 @@ describe 'PennMARC::Format' do
180
180
  end
181
181
  end
182
182
 
183
+ describe 'cartographic_show' do
184
+ let(:record) do
185
+ marc_record fields: [marc_field(tag: '255', subfields: {
186
+ a: ' Scale 1:2,534,400. 40 mi. to an in.', b: 'polyconic projection',
187
+ c: '(E 74⁰--E 84⁰/N 20⁰--N 12⁰).', d: 'Declination +90° to -90°',
188
+ e: 'equinox 1950, epoch 1949-1958'
189
+ }),
190
+ marc_field(tag: '342', subfields: { a: 'Polyconic', g: '0.9996', h: '0', i: '500,000',
191
+ j: '0' })]
192
+ end
193
+
194
+ it 'returns expected cartographic values' do
195
+ expect(helper.cartographic_show(record)).to contain_exactly(
196
+ 'Polyconic 0.9996 0 500,000 0',
197
+ 'Scale 1:2,534,400. 40 mi. to an in. polyconic projection (E 74⁰--E 84⁰/N 20⁰--N 12⁰). Declination +90° to
198
+ -90° equinox 1950, epoch 1949-1958'.squish
199
+ )
200
+ end
201
+ end
202
+
183
203
  describe '.includes_manuscript?' do
184
- context 'with a manuscript location incldued' do
204
+ context 'with a manuscript location included' do
185
205
  let(:locations) { ['Van Pelt', 'Kislak Center for Special Collections - Manuscripts Storage'] }
186
206
 
187
207
  it 'returns true' do
@@ -43,13 +43,13 @@ describe 'PennMARC::Genre' do
43
43
  end
44
44
 
45
45
  describe '.facet' do
46
- let(:values) { helper.facet(record, location_map) }
46
+ let(:values) { helper.facet(record, location_map: location_map) }
47
47
  let(:location_map) do
48
48
  { manu: { specific_location: 'Secure Manuscripts Storage' },
49
49
  vanp: { specific_location: 'Van Pelt' } }
50
50
  end
51
51
 
52
- context 'for a non-video, non-manuscript record' do
52
+ context 'with a non-video, non-manuscript record' do
53
53
  let(:fields) do
54
54
  [marc_control_field(tag: '007', value: 'x'),
55
55
  marc_field(tag: 'hld', subfields: { c: 'vanp' }),
@@ -61,7 +61,7 @@ describe 'PennMARC::Genre' do
61
61
  end
62
62
  end
63
63
 
64
- context 'for a video record' do
64
+ context 'with a video record' do
65
65
  let(:fields) do
66
66
  [marc_control_field(tag: '007', value: 'v'),
67
67
  marc_field(tag: 'hld', subfields: { c: 'vanp' }),
@@ -74,7 +74,7 @@ describe 'PennMARC::Genre' do
74
74
  end
75
75
  end
76
76
 
77
- context 'for a manuscript-located record' do
77
+ context 'with a manuscript-located record' do
78
78
  let(:fields) do
79
79
  [marc_control_field(tag: '007', value: 'x'),
80
80
  marc_field(tag: 'hld', subfields: { c: 'manu' }),
@@ -84,6 +84,7 @@ describe 'PennMARC::Identifier' do
84
84
  marc_field(tag: '880', subfields: { a: '006680200B', b: 'Island', '6': '028' })
85
85
  ]
86
86
  end
87
+
87
88
  it 'returns expected show values' do
88
89
  expect(helper.publisher_number_show(record)).to contain_exactly('602537854325',
89
90
  'B002086600 Island Def Jam Music Group',
@@ -98,8 +99,22 @@ describe 'PennMARC::Identifier' do
98
99
  marc_field(tag: '028', subfields: { a: 'B002086600', b: 'Island Def Jam Music Group' })
99
100
  ]
100
101
  end
102
+
101
103
  it 'returns expected search values' do
102
104
  expect(helper.publisher_number_search(record)).to contain_exactly('602537854325', 'B002086600')
103
105
  end
104
106
  end
107
+
108
+ describe '.fingerprint_show' do
109
+ let(:record) do
110
+ marc_record fields: [
111
+ marc_field(tag: '026', subfields: { a: 'dete nkck', b: 'vess lodo', c: 'Anno Domini MDCXXXVI', d: '3',
112
+ '2': 'fei', '5': 'penn' })
113
+ ]
114
+ end
115
+
116
+ it 'returns expected fingerprint values' do
117
+ expect(helper.fingerprint_show(record)).to contain_exactly('dete nkck vess lodo Anno Domini MDCXXXVI 3')
118
+ end
119
+ end
105
120
  end
@@ -18,7 +18,7 @@ describe 'PennMARC::Language' do
18
18
 
19
19
  describe '.search' do
20
20
  it 'returns the expected display value' do
21
- expect(helper.search(record, mapping)).to eq 'English'
21
+ expect(helper.search(record, language_map: mapping)).to eq 'English'
22
22
  end
23
23
  end
24
24
 
@@ -13,7 +13,7 @@ describe 'PennMARC::Location' do
13
13
  it 'returns expected value' do
14
14
  expect(helper.location(record: record, location_map: mapping,
15
15
  display_value: :library)).to contain_exactly('LIBRA')
16
- expect(helper.location(record:, location_map: mapping,
16
+ expect(helper.location(record: record, location_map: mapping,
17
17
  display_value: 'specific_location')).to contain_exactly('LIBRA')
18
18
  end
19
19
  end
@@ -34,6 +34,7 @@ describe 'PennMARC::Location' do
34
34
  marc_record(fields: [marc_field(tag: 'itm', subfields: { g: 'stor' }),
35
35
  marc_field(tag: 'hld', subfields: { c: 'dent' })])
36
36
  end
37
+
37
38
  it 'returns item location' do
38
39
  expect(helper.location(record: record, location_map: mapping,
39
40
  display_value: :library)).to contain_exactly('LIBRA')
@@ -199,7 +199,7 @@ describe 'PennMARC::Note' do
199
199
 
200
200
  let(:fields) do
201
201
  [
202
- marc_field(tag: '545', subfields: { a: 'A Creator', b: 'Additional Info', 'u': 'URI' }),
202
+ marc_field(tag: '545', subfields: { a: 'A Creator', b: 'Additional Info', u: 'URI' }),
203
203
  marc_field(tag: '880', subfields: { a: 'Alt Bio', b: 'Alt Info', u: 'Alt URI', '6': '545' })
204
204
  ]
205
205
  end
@@ -217,7 +217,7 @@ describe 'PennMARC::Note' do
217
217
 
218
218
  let(:fields) do
219
219
  [
220
- marc_field(tag: '520', subfields: { a: 'An Abstract', b: 'Additional Summary', 'c': 'ProQuest' }),
220
+ marc_field(tag: '520', subfields: { a: 'An Abstract', b: 'Additional Summary', c: 'ProQuest' }),
221
221
  marc_field(tag: '880', subfields: { a: 'Alt Abstract', b: 'Alt Additional Summary', c: 'Alt ProQuest',
222
222
  '6': '520' })
223
223
  ]
@@ -229,5 +229,70 @@ describe 'PennMARC::Note' do
229
229
  expect(values).to contain_exactly('An Abstract Additional Summary ProQuest',
230
230
  'Alt Abstract Alt Additional Summary Alt ProQuest')
231
231
  end
232
+
233
+ describe '.arrangement_show' do
234
+ let(:record) { marc_record(fields: fields) }
235
+
236
+ let(:fields) do
237
+ [
238
+ marc_field(tag: '351', subfields: { a: 'Organized into five subseries', b: 'Arrangement pattern', c: 'Series',
239
+ '3': 'materials' }),
240
+ marc_field(tag: '880', subfields: { a: 'Alt organization', b: 'Alt arrangement', c: 'Alt hierarchical level',
241
+ '3': 'Alt materials', '6': '351' })
242
+ ]
243
+ end
244
+
245
+ let(:values) { helper.arrangement_show(record) }
246
+
247
+ it 'returns expected values from 351 and its linked alternate' do
248
+ expect(values).to contain_exactly('Organized into five subseries Arrangement pattern Series materials',
249
+ 'Alt organization Alt arrangement Alt hierarchical level Alt materials')
250
+ end
251
+ end
252
+
253
+ describe '.system_details_show' do
254
+ let(:record) { marc_record(fields: fields) }
255
+
256
+ let(:fields) do
257
+ [
258
+ marc_field(tag: '538', subfields: { a: 'Blu-ray, region A, 1080p High Definition, full screen (1.33:1)',
259
+ i: 'display text for URI', u: 'http://www.universal.resource/locator ',
260
+ '3': ['Blu-ray disc.', '2015'] }),
261
+ marc_field(tag: '344', subfields: { a: 'digital', b: 'optical', c: '1.4 m/s', g: 'stereo',
262
+ h: 'digital recording', '3': 'audio disc' }),
263
+ marc_field(tag: '345', subfields: { a: '1 film reel (25 min.)', b: '24 fps', '3': 'Polyester print' }),
264
+ marc_field(tag: '346', subfields: { a: 'VHS', b: 'NTSC', '3': 'original videocassette' }),
265
+ marc_field(tag: '347', subfields: { a: 'video file', b: 'DVD video', e: 'region', '3': 'DVD' }),
266
+ marc_field(tag: '880', subfields: { a: 'Alt system details', i: 'Alternative display text', u: 'Alt URI',
267
+ '3': 'Alt materials.', '6': '538' }),
268
+ marc_field(tag: '880', subfields: { a: 'Alt recording', b: 'Alt medium', c: 'Alt playing speed',
269
+ g: 'Alt channel',
270
+ h: 'Alt characteristic', '3': 'Alt materials.',
271
+ '6': '344' }),
272
+ marc_field(tag: '880', subfields: { a: 'Alt presentation format', b: 'Alt projection speed',
273
+ '3': 'Alt materials.', '6': '345' }),
274
+ marc_field(tag: '880', subfields: { a: 'Alt video format', b: 'Alt broadcast', '3': 'Alt materials.',
275
+ '6': '346' }),
276
+ marc_field(tag: '880', subfields: { a: 'Alt file type', b: 'Alt encoding', '3': 'Alt materials.',
277
+ '6': 'Alt region' })
278
+
279
+ ]
280
+ end
281
+
282
+ let(:values) { helper.system_details_show(record) }
283
+
284
+ it 'returns expected from 5xx and 3xx fields and their linked alternates' do
285
+ expect(values).to contain_exactly(
286
+ 'Blu-ray disc: 2015 Blu-ray, region A, 1080p High Definition, full screen (1.33:1) display
287
+ text for URI http://www.universal.resource/locator'.squish,
288
+ 'audio disc digital optical 1.4 m/s stereo digital recording', 'Polyester print 1 film reel (25 min.) 24 fps',
289
+ 'original videocassette VHS NTSC', 'DVD video file DVD video region',
290
+ 'Alt materials Alt system details Alternative display text Alt URI',
291
+ 'Alt materials Alt recording Alt medium Alt playing speed Alt channel Alt characteristic',
292
+ 'Alt materials Alt presentation format Alt projection speed',
293
+ 'Alt materials Alt video format Alt broadcast'
294
+ )
295
+ end
296
+ end
232
297
  end
233
298
  end
@@ -65,7 +65,7 @@ describe 'PennMARC::Relation' do
65
65
  end
66
66
 
67
67
  it 'returns specified subfield values from specified field with blank indicator2' do
68
- values = helper.related_work_show record, relator_map
68
+ values = helper.related_work_show record, relator_map: relator_map
69
69
  expect(values).to contain_exactly 'Translation of: Some Author Aphorisms, Translator',
70
70
  'Alt. Prefix: Alt. Author Alt. Aphorisms'
71
71
  expect(values).not_to include 'Ignored'
@@ -81,7 +81,7 @@ describe 'PennMARC::Relation' do
81
81
  end
82
82
 
83
83
  it "returns specified subfield values from specified field with '2' in indicator2" do
84
- values = helper.contains_show record, relator_map
84
+ values = helper.contains_show record, relator_map: relator_map
85
85
  expect(values).to contain_exactly 'Alt. Prefix: Alt. Name', 'Container of: Some Author Works, Author'
86
86
  expect(values).not_to include 'Ignored'
87
87
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe 'PennMARC::Series' do
4
+ include MarcSpecHelpers
5
+
6
+ let(:helper) { PennMARC::Series }
7
+ let(:mapping) { { aut: 'Author' } }
8
+ let(:record) do
9
+ marc_record fields: [marc_field(tag: '490', subfields: { a: 'Teachings of the feathered pillow' }),
10
+ marc_field(tag: '880', subfields: { '6': '490', a: 'Учения пернатой подушки' }),
11
+ marc_field(tag: '800', subfields: { a: 'Bean Bagatolvski', d: '1997-', v: 'bk. 1' }),
12
+ marc_field(tag: '780', subfields: { a: 'National Comfort Association' }),
13
+ marc_field(tag: '785', subfields: { a: 'NCA quarterly comfortology bulletin' })]
14
+ end
15
+ let(:empty_record) do
16
+ marc_record fields: [marc_field(tag: '666', subfields: { a: 'test' })]
17
+ end
18
+
19
+ describe '.show' do
20
+ it 'returns the series' do
21
+ expect(helper.show(record, relator_map: mapping)).to contain_exactly('Bean Bagatolvski 1997- bk. 1',
22
+ 'Teachings of the feathered pillow',
23
+ 'Учения пернатой подушки')
24
+ end
25
+ end
26
+
27
+ describe '.values' do
28
+ it 'returns the values' do
29
+ expect(helper.values(record, relator_map: mapping)).to contain_exactly('Bean Bagatolvski 1997- bk. 1.')
30
+ end
31
+ end
32
+
33
+ describe '.search' do
34
+ it 'returns the search values' do
35
+ expect(helper.search(record)).to contain_exactly('Bean Bagatolvski 1997- bk. 1')
36
+ end
37
+
38
+ it 'returns an empty array if no values are found' do
39
+ expect(helper.search(empty_record)).to be_empty
40
+ end
41
+ end
42
+
43
+ describe '.get_continues_display' do
44
+ it 'gets continues for display' do
45
+ expect(helper.get_continues_display(record)).to contain_exactly('National Comfort Association')
46
+ end
47
+ end
48
+
49
+ describe '.get_continued_by_display' do
50
+ it 'gets continued by display' do
51
+ expect(helper.get_continued_by_display(record)).to contain_exactly('NCA quarterly comfortology bulletin')
52
+ end
53
+ end
54
+ end
@@ -10,7 +10,7 @@ describe 'PennMARC::Subject' do
10
10
 
11
11
  describe '.search' do
12
12
  let(:record) { marc_record fields: fields }
13
- let(:values) { helper.search(record, relator_map) }
13
+ let(:values) { helper.search(record, relator_map: relator_map) }
14
14
 
15
15
  context 'with a mix of included and excluded tags' do
16
16
  let(:fields) do
@@ -61,11 +61,11 @@ describe 'PennMARC::Subject' do
61
61
  end
62
62
 
63
63
  describe '.facet' do
64
- let(:record) { marc_record fields: }
64
+ let(:record) { marc_record fields: fields }
65
65
  let(:values) { helper.facet(record) }
66
66
 
67
67
  # TODO: find some more inspiring examples in the corpus
68
- context 'for a record with poorly-coded heading values' do
68
+ context 'with a record with poorly-coded heading values' do
69
69
  let(:fields) { [marc_field(tag: '650', indicator2: '0', subfields: { a: 'Subject - Heading' })] }
70
70
 
71
71
  it 'properly normalizes the heading value' do
@@ -73,7 +73,7 @@ describe 'PennMARC::Subject' do
73
73
  end
74
74
  end
75
75
 
76
- context 'for a record with 650 headings with a ǂa that starts with PRO or CHR' do
76
+ context 'with a record with 650 headings with a ǂa that starts with PRO or CHR' do
77
77
  let(:fields) do
78
78
  [marc_field(tag: '650', indicator2: '4', subfields: { a: '%CHR 1998', '5': 'PU' }),
79
79
  marc_field(tag: '650', indicator2: '4', subfields: { a: 'PRO Potok, Adena (donor) (Potok Collection copy)',
@@ -85,7 +85,7 @@ describe 'PennMARC::Subject' do
85
85
  end
86
86
  end
87
87
 
88
- context 'for a record with an indicator2 value of 3, 5 or 6' do
88
+ context 'with a record with an indicator2 value of 3, 5 or 6' do
89
89
  let(:fields) do
90
90
  [marc_field(tag: '650', indicator2: '3', subfields: { a: 'Nope' }),
91
91
  marc_field(tag: '650', indicator2: '5', subfields: { a: 'Nope' }),
@@ -97,7 +97,7 @@ describe 'PennMARC::Subject' do
97
97
  end
98
98
  end
99
99
 
100
- context 'for a record with a valid tag, indicator2 and source specified' do
100
+ context 'with a record with a valid tag, indicator2 and source specified' do
101
101
  let(:fields) do
102
102
  [marc_field(tag: '650', indicator2: '7',
103
103
  subfields: {
@@ -129,7 +129,7 @@ describe 'PennMARC::Subject' do
129
129
  end
130
130
 
131
131
  describe '.show' do
132
- let(:record) { marc_record fields: }
132
+ let(:record) { marc_record fields: fields }
133
133
  let(:values) { helper.facet(record) }
134
134
 
135
135
  context 'with a variety of headings' do
@@ -145,8 +145,8 @@ describe 'PennMARC::Subject' do
145
145
  end
146
146
 
147
147
  it 'shows all valid subject headings without duplicates' do
148
- expect(helper.show(record)).to match_array ['Nephrology--Periodicals', 'Nephrology',
149
- 'Kidney Diseases', 'Local Heading']
148
+ expect(helper.show(record)).to contain_exactly('Nephrology--Periodicals', 'Nephrology', 'Kidney Diseases',
149
+ 'Local Heading')
150
150
  end
151
151
  end
152
152