pennmarc 1.0.25 → 1.0.26
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/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/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/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 +0 -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 +4 -3
- data/spec/support/marc_spec_helpers.rb +0 -85
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'PennMARC::Creator' do
|
4
|
-
include MarcSpecHelpers
|
5
|
-
|
6
4
|
let(:helper) { PennMARC::Creator }
|
7
5
|
let(:mapping) { { aut: 'Author' } }
|
8
6
|
|
@@ -95,6 +93,91 @@ describe 'PennMARC::Creator' do
|
|
95
93
|
end
|
96
94
|
end
|
97
95
|
|
96
|
+
describe '.authors_list' do
|
97
|
+
let(:record) { marc_record fields: fields }
|
98
|
+
|
99
|
+
context 'with two author records' do
|
100
|
+
let(:fields) do
|
101
|
+
[marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
|
102
|
+
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
103
|
+
marc_field(tag: '700', subfields: { a: 'Surname, Alternative', '6': '100', d: '1970-' })]
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'returns single author values with no URIs anywhere' do
|
107
|
+
values = helper.authors_list(record)
|
108
|
+
expect(values).to contain_exactly 'Surname, Name', 'Surname, Alternative'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'with three author records - abbreviated names' do
|
113
|
+
let(:fields) do
|
114
|
+
[marc_field(tag: '100', subfields: { a: 'Surname, Alex', '0': 'http://cool.uri/12345', d: '1900-2000',
|
115
|
+
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
116
|
+
marc_field(tag: '110', subfields: { a: 'Second, NameX', '0': 'http://cool.uri/12345', d: '1901-2010',
|
117
|
+
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
118
|
+
marc_field(tag: '700', subfields: { a: 'Alt, Alternative', '6': '100', d: '1970-' })]
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'returns single author values with no URIs anywhere' do
|
122
|
+
values = helper.authors_list(record, first_initial_only: true)
|
123
|
+
expect(values).to contain_exactly 'Surname, A.', 'Second, N.', 'Alt, A.'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '.contributors_list' do
|
129
|
+
let(:record) { marc_record fields: fields }
|
130
|
+
|
131
|
+
context 'with two authors and four contributors records, names only' do
|
132
|
+
let(:fields) do
|
133
|
+
[marc_field(tag: '100', subfields: { a: 'Hamilton, Alex', '0': 'http://cool.uri/12345', d: '1900-2000',
|
134
|
+
e: 'author.' }),
|
135
|
+
marc_field(tag: '100', subfields: { a: 'Lincoln, Abraham', b: 'I', c: 'laureate', d: '1968', e: 'author',
|
136
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
137
|
+
'4': 'aut' }),
|
138
|
+
marc_field(tag: '700', subfields: { a: 'Einstein, Albert', '6': '100', d: '1970-', '4': 'trl',
|
139
|
+
e: 'translator' }),
|
140
|
+
marc_field(tag: '700', subfields: { a: 'Franklin, Ben', '6': '100', d: '1970-', '4': 'edt' }),
|
141
|
+
marc_field(tag: '710', subfields: { a: 'Jefferson, Thomas', '6': '100', d: '1870-', '4': 'edt' }),
|
142
|
+
marc_field(tag: '700', subfields: { a: 'Dickens, Charles', '6': '100', d: '1970-', '4': 'com' })]
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'returns two authors and four contributors' do
|
146
|
+
values = helper.contributors_list(record)
|
147
|
+
expect(values).to contain_exactly ['Author', ['Hamilton, Alex', 'Lincoln, Abraham']],
|
148
|
+
['Compiler', ['Dickens, Charles']],
|
149
|
+
['Editor', ['Franklin, Ben', 'Jefferson, Thomas']],
|
150
|
+
['Translator', ['Einstein, Albert']]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'with two authors and four contributors records, with full information and relator' do
|
155
|
+
let(:fields) do
|
156
|
+
[marc_field(tag: '100', subfields: { a: 'Hamilton, Alex', '0': 'http://cool.uri/12345', d: '1900-2000',
|
157
|
+
e: 'author.', '4': 'aut' }),
|
158
|
+
marc_field(tag: '100', subfields: { a: 'Lincoln, Abraham', b: 'I', c: 'laureate', d: '1968', e: 'author',
|
159
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
160
|
+
'4': 'aut' }),
|
161
|
+
marc_field(tag: '700', subfields: { a: 'Einstein, Albert', '6': '100', d: '1970-', '4': 'trl',
|
162
|
+
e: 'translator' }),
|
163
|
+
marc_field(tag: '700', subfields: { a: 'Franklin, Ben', '6': '100', d: '1970-', '4': 'edt' }),
|
164
|
+
marc_field(tag: '710', subfields: { a: 'Jefferson, Thomas', '6': '100', d: '1870-', '4': 'edt' }),
|
165
|
+
marc_field(tag: '700', subfields: { a: 'Dickens, Charles', '6': '100', d: '1970-', '4': 'com' }),
|
166
|
+
marc_field(tag: '880', subfields: { a: '狄更斯', '6': '700', d: '1970-', '4': 'com' }),
|
167
|
+
marc_field(tag: '700', subfields: { a: 'Twain, Mark', '6': '100', d: '1870-' })]
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'returns four contributors' do
|
171
|
+
values = helper.contributors_list(record, include_authors: false, name_only: false, vernacular: true)
|
172
|
+
expect(values).to contain_exactly ['Compiler', ['Dickens, Charles 1970-, Compiler', '狄更斯 1970-, Compiler']],
|
173
|
+
['Contributor', ['Twain, Mark 1870-, Contributor']],
|
174
|
+
['Editor',
|
175
|
+
['Franklin, Ben 1970-, Editor', 'Jefferson, Thomas 1870-, Editor']],
|
176
|
+
['Translator', ['Einstein, Albert 1970-, Translator']]
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
98
181
|
describe '.show_facet_map' do
|
99
182
|
let(:record) do
|
100
183
|
marc_record fields: [
|
@@ -302,6 +385,24 @@ describe 'PennMARC::Creator' do
|
|
302
385
|
end
|
303
386
|
end
|
304
387
|
|
388
|
+
describe '.corporate_search' do
|
389
|
+
let(:record) do
|
390
|
+
marc_record fields: [
|
391
|
+
marc_field(tag: '110', subfields: { a: 'Penn Libraries', b: 'Digital Library Development' }),
|
392
|
+
marc_field(tag: '710', subfields: { a: 'Working Group on Digital Repository Infrastructure' }),
|
393
|
+
marc_field(tag: '810', subfields: { a: 'Constellation of Repositories Strategic Team' })
|
394
|
+
]
|
395
|
+
end
|
396
|
+
|
397
|
+
it 'returns expected values' do
|
398
|
+
expect(helper.corporate_search(record)).to contain_exactly(
|
399
|
+
'Constellation of Repositories Strategic Team',
|
400
|
+
'Penn Libraries Digital Library Development',
|
401
|
+
'Working Group on Digital Repository Infrastructure'
|
402
|
+
)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
305
406
|
describe '.contributor_show' do
|
306
407
|
let(:record) { marc_record fields: fields }
|
307
408
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'PennMARC::Edition' do
|
4
|
-
include MarcSpecHelpers
|
5
|
-
|
6
4
|
let(:helper) { PennMARC::Edition }
|
7
5
|
let(:mapping) { { aut: 'Author' } }
|
8
6
|
let(:record) do
|
@@ -18,6 +16,10 @@ describe 'PennMARC::Edition' do
|
|
18
16
|
it 'returns the editions' do
|
19
17
|
expect(helper.show(record)).to contain_exactly('5th Edition Remastered', 'رمستر')
|
20
18
|
end
|
19
|
+
|
20
|
+
it 'returns the editions without alternate' do
|
21
|
+
expect(helper.show(record, with_alternate: false)).to contain_exactly('5th Edition Remastered')
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
describe '.values' do
|
@@ -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
|