pennmarc 1.0.25 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +8 -9
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.md +16 -1
- data/lib/pennmarc/heading_control.rb +22 -4
- data/lib/pennmarc/helpers/creator.rb +139 -65
- data/lib/pennmarc/helpers/edition.rb +5 -3
- data/lib/pennmarc/helpers/note.rb +24 -19
- data/lib/pennmarc/helpers/production.rb +113 -20
- data/lib/pennmarc/helpers/subject.rb +32 -22
- data/lib/pennmarc/mappers.rb +22 -10
- data/lib/pennmarc/mappings/headings_override.yml +8 -0
- data/lib/pennmarc/mappings/headings_remove.yml +2 -0
- data/lib/pennmarc/test/marc_helpers.rb +83 -0
- data/lib/pennmarc/util.rb +98 -69
- data/lib/pennmarc/version.rb +1 -1
- data/lib/pennmarc.rb +7 -0
- data/pennmarc.gemspec +2 -1
- data/spec/lib/pennmarc/heading_control_spec.rb +45 -0
- data/spec/lib/pennmarc/helpers/access_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/citation_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/classification_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/creator_spec.rb +103 -2
- data/spec/lib/pennmarc/helpers/database_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/date_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/edition_spec.rb +4 -2
- data/spec/lib/pennmarc/helpers/format_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/genre_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/identifer_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/inventory_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/language_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/link_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/location_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/note_spec.rb +22 -29
- data/spec/lib/pennmarc/helpers/production_spec.rb +121 -22
- data/spec/lib/pennmarc/helpers/relation_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/series_spec.rb +0 -2
- data/spec/lib/pennmarc/helpers/subject_spec.rb +19 -2
- data/spec/lib/pennmarc/helpers/title_spec.rb +0 -2
- data/spec/lib/pennmarc/marc_util_spec.rb +0 -2
- data/spec/lib/pennmarc/parser_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- data/spec/support/fixture_helpers.rb +10 -0
- metadata +23 -3
- data/spec/support/marc_spec_helpers.rb +0 -85
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'PennMARC::Note' do
|
4
|
-
include MarcSpecHelpers
|
5
|
-
|
6
4
|
let(:helper) { PennMARC::Note }
|
5
|
+
let(:record) { marc_record(fields: fields) }
|
7
6
|
|
8
7
|
describe '.notes_show' do
|
9
|
-
let(:record) { marc_record(fields: fields) }
|
10
8
|
let(:fields) do
|
11
9
|
[
|
12
10
|
marc_field(tag: '500',
|
@@ -39,7 +37,6 @@ describe 'PennMARC::Note' do
|
|
39
37
|
end
|
40
38
|
|
41
39
|
describe '.local_notes_show' do
|
42
|
-
let(:record) { marc_record(fields: fields) }
|
43
40
|
let(:fields) do
|
44
41
|
[
|
45
42
|
marc_field(tag: '561', subfields: { a: 'Athenaeum copy: ', u: 'No URI' }),
|
@@ -76,7 +73,6 @@ describe 'PennMARC::Note' do
|
|
76
73
|
end
|
77
74
|
|
78
75
|
describe '.provenance_show' do
|
79
|
-
let(:record) { marc_record(fields: fields) }
|
80
76
|
let(:fields) do
|
81
77
|
[
|
82
78
|
marc_field(tag: '561', subfields: { a: 'Not Athenaeum copy: ', u: 'No URI' }, indicator1: '1', indicator2: ' '),
|
@@ -99,29 +95,35 @@ describe 'PennMARC::Note' do
|
|
99
95
|
end
|
100
96
|
end
|
101
97
|
|
102
|
-
describe '.
|
103
|
-
let(:record) { marc_record(fields: fields) }
|
98
|
+
describe '.contents_values' do
|
104
99
|
let(:fields) do
|
105
|
-
[
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
r: 'Alt Responsible Agent', t: 'Alt Title', u: 'Alt URI', '6': '505' })
|
110
|
-
]
|
100
|
+
[marc_field(tag: '505', subfields: { a: 'Formatted content notes', g: 'Misc Info', r: 'Responsible Agent',
|
101
|
+
t: 'A Title', u: 'URI' }),
|
102
|
+
marc_field(tag: '880', subfields: { a: 'Alt Formatted content notes', g: ' Alt Misc Info',
|
103
|
+
r: 'Alt Responsible Agent', t: 'Alt Title', u: 'Alt URI', '6': '505' })]
|
111
104
|
end
|
112
105
|
|
113
|
-
|
106
|
+
context 'with vernacular included' do
|
107
|
+
let(:values) { helper.contents_values(record) }
|
114
108
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
109
|
+
it 'returns expected values from 505 and its linked alternate' do
|
110
|
+
expect(values).to contain_exactly(
|
111
|
+
'Formatted content notes Misc Info Responsible Agent A Title URI',
|
112
|
+
'Alt Formatted content notes Alt Misc Info Alt Responsible Agent Alt Title Alt URI'
|
113
|
+
)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'with vernacular excluded' do
|
118
|
+
let(:values) { helper.contents_values(record, with_alternate: false) }
|
119
|
+
|
120
|
+
it 'returns expected values from 505 but not its linked alternate' do
|
121
|
+
expect(values).to contain_exactly('Formatted content notes Misc Info Responsible Agent A Title URI')
|
122
|
+
end
|
120
123
|
end
|
121
124
|
end
|
122
125
|
|
123
126
|
describe '.access_restriction_show' do
|
124
|
-
let(:record) { marc_record(fields: fields) }
|
125
127
|
let(:fields) do
|
126
128
|
[
|
127
129
|
marc_field(tag: '506', subfields: { a: 'Open to users with valid PennKey', b: 'Donor', c: 'Appointment Only',
|
@@ -129,7 +131,6 @@ describe 'PennMARC::Note' do
|
|
129
131
|
g: '20300101', q: 'Van Pelt', u: 'URI', '2': 'star' })
|
130
132
|
]
|
131
133
|
end
|
132
|
-
|
133
134
|
let(:values) { helper.access_restriction_show(record) }
|
134
135
|
|
135
136
|
it 'returns expected values from 506' do
|
@@ -141,8 +142,6 @@ describe 'PennMARC::Note' do
|
|
141
142
|
end
|
142
143
|
|
143
144
|
describe '.finding_aid_show' do
|
144
|
-
let(:record) { marc_record(fields: fields) }
|
145
|
-
|
146
145
|
let(:fields) do
|
147
146
|
[
|
148
147
|
marc_field(tag: '555', subfields: { a: 'Finding aid', b: 'Source', c: 'Item level control',
|
@@ -151,7 +150,6 @@ describe 'PennMARC::Note' do
|
|
151
150
|
d: 'Alt citation', u: 'Alt URI', '3': 'Alt Materials', '6': '555' })
|
152
151
|
]
|
153
152
|
end
|
154
|
-
|
155
153
|
let(:values) { helper.finding_aid_show(record) }
|
156
154
|
|
157
155
|
it 'returns expected values from 555 and its linked alternate' do
|
@@ -163,15 +161,12 @@ describe 'PennMARC::Note' do
|
|
163
161
|
end
|
164
162
|
|
165
163
|
describe '.participant_show' do
|
166
|
-
let(:record) { marc_record(fields: fields) }
|
167
|
-
|
168
164
|
let(:fields) do
|
169
165
|
[
|
170
166
|
marc_field(tag: '511', subfields: { a: 'Narrator: Some Dev' }),
|
171
167
|
marc_field(tag: '880', subfields: { a: 'Alt Participant', '6': '511' })
|
172
168
|
]
|
173
169
|
end
|
174
|
-
|
175
170
|
let(:values) { helper.participant_show(record) }
|
176
171
|
|
177
172
|
it 'returns expected values from 511 and its linked alternate' do
|
@@ -180,8 +175,6 @@ describe 'PennMARC::Note' do
|
|
180
175
|
end
|
181
176
|
|
182
177
|
describe '.credits_show' do
|
183
|
-
let(:record) { marc_record(fields: fields) }
|
184
|
-
|
185
178
|
let(:fields) do
|
186
179
|
[
|
187
180
|
marc_field(tag: '508', subfields: { a: 'Music: Some Dev' }),
|
@@ -1,13 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'PennMARC::Production' do
|
4
|
-
include MarcSpecHelpers
|
5
|
-
|
6
4
|
let(:helper) { PennMARC::Production }
|
5
|
+
let(:record) { marc_record fields: fields }
|
7
6
|
|
8
7
|
describe '.show' do
|
9
|
-
let(:record) { marc_record fields: fields }
|
10
|
-
|
11
8
|
let(:fields) do
|
12
9
|
[
|
13
10
|
marc_field(tag: '264', subfields: { a: 'Marabella, Trinidad, West Indies',
|
@@ -19,7 +16,6 @@ describe 'PennMARC::Production' do
|
|
19
16
|
indicator2: '0')
|
20
17
|
]
|
21
18
|
end
|
22
|
-
|
23
19
|
let(:values) { helper.show(record) }
|
24
20
|
|
25
21
|
it 'returns expected values' do
|
@@ -31,6 +27,21 @@ describe 'PennMARC::Production' do
|
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
30
|
+
describe '.search' do
|
31
|
+
let(:fields) do
|
32
|
+
[
|
33
|
+
marc_field(tag: '260', subfields: { a: 'Marabella, Trinidad, West Indies',
|
34
|
+
b: 'Ramjohn Publishing', c: '1999' }, indicator2: '0'),
|
35
|
+
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Productions', c: '2019' }, indicator2: '0'),
|
36
|
+
marc_field(tag: '264', subfields: { a: 'Nowhere', b: 'Wasteland Publishing', c: '1999' }, indicator2: '1')
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns expected values' do
|
41
|
+
expect(helper.search(record)).to contain_exactly('Wasteland Publishing', 'Ramjohn Publishing')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
34
45
|
describe '.distribution_show' do
|
35
46
|
let(:record) { marc_record fields: fields }
|
36
47
|
let(:fields) do
|
@@ -57,7 +68,6 @@ describe 'PennMARC::Production' do
|
|
57
68
|
|
58
69
|
describe '.manufacture_show' do
|
59
70
|
let(:record) { marc_record fields: fields }
|
60
|
-
|
61
71
|
let(:fields) do
|
62
72
|
[
|
63
73
|
marc_field(tag: '264', subfields: { a: 'Marabella, Trinidad, West Indies',
|
@@ -69,7 +79,6 @@ describe 'PennMARC::Production' do
|
|
69
79
|
indicator2: '3')
|
70
80
|
]
|
71
81
|
end
|
72
|
-
|
73
82
|
let(:values) { helper.manufacture_show(record) }
|
74
83
|
|
75
84
|
it 'returns expected values' do
|
@@ -83,8 +92,6 @@ describe 'PennMARC::Production' do
|
|
83
92
|
|
84
93
|
describe '.publication_values' do
|
85
94
|
context 'with date in 245 ǂf' do
|
86
|
-
let(:record) { marc_record fields: fields }
|
87
|
-
|
88
95
|
let(:fields) do
|
89
96
|
[
|
90
97
|
marc_field(tag: '245', subfields: { f: '1869-1941' }),
|
@@ -93,7 +100,6 @@ describe 'PennMARC::Production' do
|
|
93
100
|
c: '1920' }, indicator2: '1')
|
94
101
|
]
|
95
102
|
end
|
96
|
-
|
97
103
|
let(:values) { helper.publication_values(record) }
|
98
104
|
|
99
105
|
it 'returns expected values' do
|
@@ -103,16 +109,13 @@ describe 'PennMARC::Production' do
|
|
103
109
|
end
|
104
110
|
|
105
111
|
context 'with 260, 261, or 262 fields' do
|
106
|
-
let(:record) { marc_record fields: fields }
|
107
|
-
|
108
112
|
let(:fields) do
|
109
113
|
[
|
110
|
-
marc_field(tag: '260', subfields: { a: '
|
114
|
+
marc_field(tag: '260', subfields: { a: 'Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
111
115
|
c: '1985, c1956.' }),
|
112
116
|
marc_field(tag: '264', subfields: { a: 'Nowhere', b: 'Wasteland Publishers', c: '1999' }, indicator2: '1')
|
113
117
|
]
|
114
118
|
end
|
115
|
-
|
116
119
|
let(:values) { helper.publication_values(record) }
|
117
120
|
|
118
121
|
it 'returns expected values' do
|
@@ -121,8 +124,6 @@ describe 'PennMARC::Production' do
|
|
121
124
|
end
|
122
125
|
|
123
126
|
context 'without 260, 261, or 262 fields' do
|
124
|
-
let(:record) { marc_record fields: fields }
|
125
|
-
|
126
127
|
let(:fields) do
|
127
128
|
[
|
128
129
|
marc_field(tag: '264', subfields: { a: 'Nowhere', b: 'Wasteland Publishers', c: '1999' }, indicator2: '1'),
|
@@ -130,7 +131,6 @@ describe 'PennMARC::Production' do
|
|
130
131
|
marc_field(tag: '264', subfields: { c: ' c2016' }, indicator2: '4')
|
131
132
|
]
|
132
133
|
end
|
133
|
-
|
134
134
|
let(:values) { helper.publication_values(record) }
|
135
135
|
|
136
136
|
it 'returns publication values from field 264' do
|
@@ -140,8 +140,6 @@ describe 'PennMARC::Production' do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
describe '.publication_show' do
|
143
|
-
let(:record) { marc_record fields: fields }
|
144
|
-
|
145
143
|
let(:fields) do
|
146
144
|
[marc_field(tag: '245', subfields: { f: 'between 1800-1850' }),
|
147
145
|
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
@@ -154,7 +152,6 @@ describe 'PennMARC::Production' do
|
|
154
152
|
marc_field(tag: '880', subfields: { a: 'Linked', b: 'Alternate Publishers', c: '880', '6': '264' },
|
155
153
|
indicator2: '1')]
|
156
154
|
end
|
157
|
-
|
158
155
|
let(:values) { helper.publication_show(record) }
|
159
156
|
|
160
157
|
it 'returns expected values' do
|
@@ -167,9 +164,38 @@ describe 'PennMARC::Production' do
|
|
167
164
|
end
|
168
165
|
end
|
169
166
|
|
170
|
-
describe '
|
167
|
+
describe '.publication_citation_show' do
|
171
168
|
let(:record) { marc_record fields: fields }
|
172
169
|
|
170
|
+
let(:fields) do
|
171
|
+
[marc_field(tag: '245', subfields: { f: 'between 1800-1850' }),
|
172
|
+
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
173
|
+
c: '1985, c1956.' }),
|
174
|
+
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Press', c: '2019' }, indicator2: '1'),
|
175
|
+
marc_field(tag: '880', subfields: { f: 'Alternate 1800-1850', '6': '245' }),
|
176
|
+
marc_field(tag: '880',
|
177
|
+
subfields: { a: 'Alternate England', b: 'Alternate Longman', c: 'Alternate 1985, c1956.',
|
178
|
+
'6': '260' }),
|
179
|
+
marc_field(tag: '880', subfields: { a: 'Linked', b: 'Alternate Publishers', c: '880', '6': '264' },
|
180
|
+
indicator2: '1')]
|
181
|
+
end
|
182
|
+
let(:values) { helper.publication_citation_show(record) }
|
183
|
+
let(:values_no_year) { helper.publication_citation_show(record, with_year: false) }
|
184
|
+
|
185
|
+
it 'returns publication citation values' do
|
186
|
+
expect(values).to contain_exactly('between 1800-1850',
|
187
|
+
'Burnt Mill, Harlow, Essex, England Longman 1985, c1956.',
|
188
|
+
'Leeds Peepal Tree Press 2019')
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'returns publication citation values without year' do
|
192
|
+
expect(values_no_year).to contain_exactly('between 1800-1850',
|
193
|
+
'Burnt Mill, Harlow, Essex, England Longman',
|
194
|
+
'Leeds Peepal Tree Press')
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe 'place_of_publication_show' do
|
173
199
|
let(:fields) do
|
174
200
|
[marc_field(tag: '752', subfields: { a: 'United States', b: 'California', c: 'Los Angeles (County)',
|
175
201
|
d: 'Los Angeles', e: 'publication place', f: 'Little Tokyo',
|
@@ -180,7 +206,6 @@ describe 'PennMARC::Production' do
|
|
180
206
|
f: 'Alt Tokyo', g: 'NA',
|
181
207
|
h: 'Alt Earth', '6': '752' })]
|
182
208
|
end
|
183
|
-
|
184
209
|
let(:values) { helper.place_of_publication_show(record) }
|
185
210
|
|
186
211
|
it 'returns expected values' do
|
@@ -190,4 +215,78 @@ describe 'PennMARC::Production' do
|
|
190
215
|
)
|
191
216
|
end
|
192
217
|
end
|
218
|
+
|
219
|
+
describe 'place_of_publication_search' do
|
220
|
+
let(:values) { helper.place_of_publication_search(record) }
|
221
|
+
|
222
|
+
context 'with publication info in the 26x fields' do
|
223
|
+
let(:fields) do
|
224
|
+
[marc_field(tag: '260', subfields: { a: 'Marabella, Trinidad, West Indies',
|
225
|
+
b: 'Ramjohn Publishing', c: '1999' }, indicator2: '0'),
|
226
|
+
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Productions', c: '2019' }, indicator2: '0'),
|
227
|
+
marc_field(tag: '264', subfields: { a: 'Nowhere', b: 'Wasteland Publishing', c: '1983' }, indicator2: '1')]
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'returns expected values' do
|
231
|
+
expect(values).to contain_exactly('Marabella, Trinidad, West Indies', 'Nowhere')
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'with publication info in 752' do
|
236
|
+
let(:fields) do
|
237
|
+
[marc_field(tag: '752', subfields: { a: 'United States', b: 'California', c: 'Los Angeles (County)',
|
238
|
+
d: 'Los Angeles', e: 'publication place', f: 'Little Tokyo',
|
239
|
+
g: 'North America', h: 'Earth' })]
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'returns expected values' do
|
243
|
+
expect(values).to contain_exactly(
|
244
|
+
'United States California Los Angeles (County) Los Angeles Little Tokyo North America Earth'
|
245
|
+
)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
describe 'publication_ris_place_of_pub' do
|
251
|
+
let(:record) { marc_record fields: fields }
|
252
|
+
let(:fields) do
|
253
|
+
[marc_field(tag: '245', subfields: { f: 'between 1800-1850' }),
|
254
|
+
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
255
|
+
c: '1985, c1956.' }),
|
256
|
+
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Press', c: '2019' }, indicator2: '1'),
|
257
|
+
marc_field(tag: '880', subfields: { f: 'Alternate 1800-1850', '6': '245' }),
|
258
|
+
marc_field(tag: '880',
|
259
|
+
subfields: { a: 'Alternate England', b: 'Alternate Longman', c: 'Alternate 1985, c1956.',
|
260
|
+
'6': '260' }),
|
261
|
+
marc_field(tag: '880', subfields: { a: 'Linked', b: 'Alternate Publishers', c: '880', '6': '264' },
|
262
|
+
indicator2: '1')]
|
263
|
+
end
|
264
|
+
|
265
|
+
let(:values) { helper.publication_ris_place_of_pub(record) }
|
266
|
+
|
267
|
+
it 'returns expected values' do
|
268
|
+
expect(values).to contain_exactly('between 1800-1850', 'Burnt Mill, Harlow, Essex, England', 'Leeds')
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
describe 'publication_ris_publisher' do
|
273
|
+
let(:record) { marc_record fields: fields }
|
274
|
+
let(:fields) do
|
275
|
+
[marc_field(tag: '245', subfields: { f: 'between 1800-1850' }),
|
276
|
+
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
277
|
+
c: '1985, c1956.' }),
|
278
|
+
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Press', c: '2019' }, indicator2: '1'),
|
279
|
+
marc_field(tag: '880', subfields: { f: 'Alternate 1800-1850', '6': '245' }),
|
280
|
+
marc_field(tag: '880',
|
281
|
+
subfields: { a: 'Alternate England', b: 'Alternate Longman', c: 'Alternate 1985, c1956.',
|
282
|
+
'6': '260' }),
|
283
|
+
marc_field(tag: '880', subfields: { a: 'Linked', b: 'Alternate Publishers', c: '880', '6': '264' },
|
284
|
+
indicator2: '1')]
|
285
|
+
end
|
286
|
+
let(:values) { helper.publication_ris_publisher(record) }
|
287
|
+
|
288
|
+
it 'returns expected values' do
|
289
|
+
expect(values).to contain_exactly('between 1800-1850', 'Longman', 'Peepal Tree Press')
|
290
|
+
end
|
291
|
+
end
|
193
292
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'PennMARC::Subject' do
|
4
|
-
include MarcSpecHelpers
|
5
|
-
|
6
4
|
let(:helper) { PennMARC::Subject }
|
7
5
|
let(:relator_map) do
|
8
6
|
{ dpc: 'Depicted' }
|
@@ -304,6 +302,25 @@ describe 'PennMARC::Subject' do
|
|
304
302
|
expect(values).to contain_exactly 'Philosophy in motion pictures.'
|
305
303
|
end
|
306
304
|
end
|
305
|
+
|
306
|
+
context 'with headings that contain terms for removal and replacement' do
|
307
|
+
let(:fields) do
|
308
|
+
[marc_field(tag: '650', subfields: { a: 'History.' }),
|
309
|
+
marc_field(tag: '650', subfields: { a: PennMARC::Mappers.headings_to_remove.first }),
|
310
|
+
marc_field(tag: '650', subfields: { a: PennMARC::Mappers.heading_overrides.first[0] })]
|
311
|
+
end
|
312
|
+
|
313
|
+
it 'removes and replaces terms as expected' do
|
314
|
+
expect(values).to contain_exactly 'History.', "#{PennMARC::Mappers.heading_overrides.first[1]}."
|
315
|
+
end
|
316
|
+
|
317
|
+
it 'does not remove or replace terms if override param is false' do
|
318
|
+
expect(helper.show(record, override: false)).to contain_exactly(
|
319
|
+
'History.', "#{PennMARC::Mappers.headings_to_remove.first}.",
|
320
|
+
"#{PennMARC::Mappers.heading_overrides.first[0]}."
|
321
|
+
)
|
322
|
+
end
|
323
|
+
end
|
307
324
|
end
|
308
325
|
|
309
326
|
describe '.childrens_show' do
|
data/spec/spec_helper.rb
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
|
3
3
|
$LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
|
4
4
|
|
5
|
+
# Require spec-specific helpers dir
|
5
6
|
Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }
|
6
7
|
|
8
|
+
# Require test helpers from gem lib
|
9
|
+
Dir[File.join(__dir__, '../lib/pennmarc/test', '*.rb')].each { |f| require f }
|
10
|
+
|
7
11
|
require 'pennmarc'
|
8
12
|
|
9
13
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
@@ -22,6 +26,9 @@ require 'pennmarc'
|
|
22
26
|
#
|
23
27
|
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
24
28
|
RSpec.configure do |config|
|
29
|
+
# Include MarcHelpers by default
|
30
|
+
config.include(PennMARC::Test::MarcHelpers)
|
31
|
+
|
25
32
|
# rspec-expectations config goes here. You can use an alternate
|
26
33
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
27
34
|
# assertions if you prefer.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FixtureHelpers
|
4
|
+
# Get the path for a test MARC XML file
|
5
|
+
# @param [String] filename of MARCXML fixture
|
6
|
+
# @return [String] full path of MARCXML fixture
|
7
|
+
def marc_xml_path(filename)
|
8
|
+
File.join File.dirname(__FILE__), '..', 'fixtures', 'marcxml', filename
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennmarc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kanning
|
8
8
|
- Amrey Mathurin
|
9
9
|
- Patrick Perkins
|
10
|
+
- Katherine Schultz
|
11
|
+
- Baowei Wei
|
10
12
|
autorequire:
|
11
13
|
bindir: bin
|
12
14
|
cert_chain: []
|
13
|
-
date: 2024-
|
15
|
+
date: 2024-07-14 00:00:00.000000000 Z
|
14
16
|
dependencies:
|
15
17
|
- !ruby/object:Gem::Dependency
|
16
18
|
name: activesupport
|
@@ -54,6 +56,20 @@ dependencies:
|
|
54
56
|
- - "~>"
|
55
57
|
- !ruby/object:Gem::Version
|
56
58
|
version: '1.2'
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: multi_string_replace
|
61
|
+
requirement: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - "~>"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '2.0'
|
57
73
|
- !ruby/object:Gem::Dependency
|
58
74
|
name: nokogiri
|
59
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +132,8 @@ files:
|
|
116
132
|
- lib/pennmarc/helpers/title.rb
|
117
133
|
- lib/pennmarc/mappers.rb
|
118
134
|
- lib/pennmarc/mappings/dewey_classification.yml
|
135
|
+
- lib/pennmarc/mappings/headings_override.yml
|
136
|
+
- lib/pennmarc/mappings/headings_remove.yml
|
119
137
|
- lib/pennmarc/mappings/iso639-2-languages.yml
|
120
138
|
- lib/pennmarc/mappings/iso639-3-languages.yml
|
121
139
|
- lib/pennmarc/mappings/loc_classification.yml
|
@@ -123,10 +141,12 @@ files:
|
|
123
141
|
- lib/pennmarc/mappings/locations.yml
|
124
142
|
- lib/pennmarc/mappings/relator.yml
|
125
143
|
- lib/pennmarc/parser.rb
|
144
|
+
- lib/pennmarc/test/marc_helpers.rb
|
126
145
|
- lib/pennmarc/util.rb
|
127
146
|
- lib/pennmarc/version.rb
|
128
147
|
- pennmarc.gemspec
|
129
148
|
- spec/fixtures/marcxml/test.xml
|
149
|
+
- spec/lib/pennmarc/heading_control_spec.rb
|
130
150
|
- spec/lib/pennmarc/helpers/access_spec.rb
|
131
151
|
- spec/lib/pennmarc/helpers/citation_spec.rb
|
132
152
|
- spec/lib/pennmarc/helpers/classification_spec.rb
|
@@ -150,7 +170,7 @@ files:
|
|
150
170
|
- spec/lib/pennmarc/marc_util_spec.rb
|
151
171
|
- spec/lib/pennmarc/parser_spec.rb
|
152
172
|
- spec/spec_helper.rb
|
153
|
-
- spec/support/
|
173
|
+
- spec/support/fixture_helpers.rb
|
154
174
|
homepage: https://gitlab.library.upenn.edu/dld/catalog/pennmarc
|
155
175
|
licenses:
|
156
176
|
- MIT
|