pennmarc 1.2.3 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96396e62916d963919d655e236402c3ae40386dc9ac6078e135f2d9c41481375
4
- data.tar.gz: 554416ba78ce36f00e15b240e988421096349966edc5617b6c5b1f3d573d19f8
3
+ metadata.gz: 21463a3d231e3ba853929bc03241d8e3c109c6191d3a5747c1a397aad40e454d
4
+ data.tar.gz: e747a26ee6ed508b13a3079acd2291d194d4a9a9bc4a984dcefd8145d5f76084
5
5
  SHA512:
6
- metadata.gz: 7b64b529c5929690130cce0480a0e7fd99d32c435e5cf37daa058ab55838c28f246c8cb250f0ee9a4c2c243a118a6815add56f16df6c8bd54edd4b08022b7e36
7
- data.tar.gz: fcb648bce5413f48f719050e528ed9f329618cbb5ca0af5e15aa02abd40f35fedb81e64d4614e8fcea2f32a6c6b5784ac7559c44a4771a1ef17321fc56d2b220
6
+ metadata.gz: ee0a42b85b4862caca7417176947497d63253d07818341e3ef483789554dfcf06eff4f658a89d44d865e7354f4dcae3e88e060cdd41c941e016de5d86e8ad365
7
+ data.tar.gz: ca200369654cb607e14ea1225ce785a90ca05da9f5fe9a3a7390748b997b4b5e423f26a1c832bfab14c339a493af39f2422171b647542f92a926e5c2a7405993
data/.gitlab-ci.yml CHANGED
@@ -1,65 +1,34 @@
1
+ ---
1
2
  include:
2
- - project: "devops/gitlab/ci-templates/general"
3
- file:
4
- - ".install_hashicorp_vault.yml"
5
- - ".vault_jwt_auth.yml"
6
- - project: "devops/gitlab/ci-templates/ruby"
7
- ref: "sans-dind"
8
- file:
9
- - ".rspec.yml"
10
- - ".rubocop.yml"
11
- - template: "Workflows/MergeRequest-Pipelines.gitlab-ci.yml"
3
+ - template: Jobs/Secret-Detection.gitlab-ci.yml
12
4
 
13
5
  stages:
14
- - test
15
- - deploy
6
+ - secret_check
7
+ - main_pipeline
16
8
 
17
- rspec_app_test:
18
- stage: test
19
- image: ruby:3.2.2
20
- before_script:
21
- - bundle install -j $(nproc)
22
- extends:
23
- - .rspec
24
- tags:
25
- - build
26
-
27
- rubocop_app_test:
28
- stage: test
29
- image: ruby:3.2.2
30
- before_script:
31
- - bundle install -j $(nproc)
32
- extends:
33
- - .rubocop
9
+ secret_detection:
10
+ stage: secret_check
11
+ allow_failure: false
12
+ artifacts:
13
+ paths:
14
+ - .pipeline.yml
15
+ expire_in: 1 day
34
16
  tags:
35
17
  - build
18
+ rules:
19
+ - when: always
36
20
 
37
- # This step was inspired from Gitlab's example of gem publication:
38
- # https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/gem-release.yml
39
- gem_publication:
40
- stage: deploy
41
- image: ruby:3.2.2
42
- variables:
43
- GEMSPEC_FILE: "${CI_PROJECT_NAME}.gemspec"
44
- before_script:
45
- - !reference [.install_hashicorp_vault, before_script]
46
- - !reference [.vault_jwt_auth, before_script]
47
- - export GEM_HOST_API_KEY="$(vault kv get -field=rubygems_api_key ${VAULT_KV_ENDPOINT}${ENVIRONMENT})"
48
- - |
49
- gem -v
50
- rm -f ./*.gem
51
- [ -f "${GEMSPEC_FILE}" ] || (echo "No ${GEMSPEC_FILE} file found!" && exit 1)
52
- - '[ -n "${GEM_HOST_API_KEY}" ] || (echo "GEM_HOST_API_KEY is not set!" && exit 1)'
53
- script:
54
- - GEM_FILE=$(echo "${CI_PROJECT_NAME}-${CI_COMMIT_TAG:1}.gem")
55
- - |
56
- gem build "${GEMSPEC_FILE}"
57
- [ -f "${GEM_FILE}" ] || (echo "No ${GEM_FILE} file found!" && exit 1)
58
- - '[ "${DISABLE_GEM_PUSH}" == "true" ] || gem push "${GEM_FILE}"'
21
+ main:
22
+ stage: main_pipeline
23
+ needs:
24
+ - secret_detection
25
+ allow_failure: false
26
+ trigger:
27
+ include:
28
+ - artifact: .pipeline.yml
29
+ job: secret_detection
30
+ strategy: depend
59
31
  rules:
60
- - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(\.[a-zA-Z0-9]+)?$/
61
- artifacts:
62
- paths:
63
- - "*.gem"
64
- tags:
65
- - deploy
32
+ - if: "$CI_MERGE_REQUEST_IID"
33
+ - if: "$CI_COMMIT_TAG"
34
+ - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
data/.pipeline.yml ADDED
@@ -0,0 +1,64 @@
1
+ include:
2
+ - project: "devops/gitlab/ci-templates/general"
3
+ file:
4
+ - ".install_hashicorp_vault.yml"
5
+ - ".vault_jwt_auth.yml"
6
+ - project: "devops/gitlab/ci-templates/ruby"
7
+ ref: "sans-dind"
8
+ file:
9
+ - ".rspec.yml"
10
+ - ".rubocop.yml"
11
+
12
+ stages:
13
+ - test
14
+ - deploy
15
+
16
+ rspec_app_test:
17
+ stage: test
18
+ image: ruby:3.2.2
19
+ before_script:
20
+ - bundle install -j $(nproc)
21
+ extends:
22
+ - .rspec
23
+ tags:
24
+ - build
25
+
26
+ rubocop_app_test:
27
+ stage: test
28
+ image: ruby:3.2.2
29
+ before_script:
30
+ - bundle install -j $(nproc)
31
+ extends:
32
+ - .rubocop
33
+ tags:
34
+ - build
35
+
36
+ # This step was inspired from Gitlab's example of gem publication:
37
+ # https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/gem-release.yml
38
+ gem_publication:
39
+ stage: deploy
40
+ image: ruby:3.2.2
41
+ variables:
42
+ GEMSPEC_FILE: "${CI_PROJECT_NAME}.gemspec"
43
+ before_script:
44
+ - !reference [.install_hashicorp_vault, before_script]
45
+ - !reference [.vault_jwt_auth, before_script]
46
+ - export GEM_HOST_API_KEY="$(vault kv get -field=rubygems_api_key ${VAULT_KV_ENDPOINT}${ENVIRONMENT})"
47
+ - |
48
+ gem -v
49
+ rm -f ./*.gem
50
+ [ -f "${GEMSPEC_FILE}" ] || (echo "No ${GEMSPEC_FILE} file found!" && exit 1)
51
+ - '[ -n "${GEM_HOST_API_KEY}" ] || (echo "GEM_HOST_API_KEY is not set!" && exit 1)'
52
+ script:
53
+ - GEM_FILE=$(echo "${CI_PROJECT_NAME}-${CI_COMMIT_TAG:1}.gem")
54
+ - |
55
+ gem build "${GEMSPEC_FILE}"
56
+ [ -f "${GEM_FILE}" ] || (echo "No ${GEM_FILE} file found!" && exit 1)
57
+ - '[ "${DISABLE_GEM_PUSH}" == "true" ] || gem push "${GEM_FILE}"'
58
+ rules:
59
+ - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(\.[a-zA-Z0-9]+)?$/
60
+ artifacts:
61
+ paths:
62
+ - "*.gem"
63
+ tags:
64
+ - deploy
@@ -43,7 +43,8 @@ module PennMARC
43
43
  }.uniq
44
44
  end
45
45
 
46
- # Genre values for faceting. We only set Genre facet values for movies (videos) and manuscripts(?)
46
+ # Genre values for faceting. We only set Genre facet values for movies (videos) and manuscripts(?), and ensure
47
+ # that the headings come from our set of approved ontologies.
47
48
  # @todo the Genre facet in Franklin is pretty ugly. It could be cleaned up by limiting the subfields included
48
49
  # here and cleaning up punctuation.
49
50
  # @param record [MARC::Record]
@@ -55,6 +56,8 @@ module PennMARC
55
56
  return [] unless manuscript || video
56
57
 
57
58
  record.fields('655').filter_map { |field|
59
+ next unless allowed_genre_field?(field)
60
+
58
61
  join_subfields field, &subfield_not_in?(%w[0 2 5 c])
59
62
  }.uniq
60
63
  end
@@ -21,6 +21,16 @@ module PennMARC
21
21
  }.uniq
22
22
  end
23
23
 
24
+ # Get "Contained in" values from {https://www.oclc.org/bibformats/en/7xx/773.html MARC 773}
25
+ # subfield g for related parts.
26
+ # @param record [MARC::Record]
27
+ # @return [Array<String>] related parts values for display
28
+ def contained_in_related_parts_show(record)
29
+ record.fields('773').map { |field|
30
+ join_subfields(field, &subfield_in?(%w[g]))
31
+ }.uniq
32
+ end
33
+
24
34
  # Get "chronology" information from specially-prefixed 650 (subject) fields
25
35
  # @todo why do we stuff chronology data in a 650 field?
26
36
  # @param record [MARC::Record]
@@ -32,6 +32,9 @@ module PennMARC
32
32
  # This text is used in Alma to indicate a Bib record is a "Host" record for other bibs (bound-withs)
33
33
  HOST_BIB_TITLE = 'Host bibliographic record for boundwith'
34
34
 
35
+ # Title to use when no 245 field is present. This "shouldn't" occur, but it does.
36
+ NO_TITLE_PROVIDED = '[No title provided]'
37
+
35
38
  class << self
36
39
  # Main Title Search field. Takes from {https://www.loc.gov/marc/bibliographic/bd245.html 245} and linked 880.
37
40
  # @note Ported from get_title_1_search_values.
@@ -93,6 +96,8 @@ module PennMARC
93
96
  # @return [String] single title for display
94
97
  def show(record)
95
98
  field = record.fields('245')&.first
99
+ return Array.wrap(NO_TITLE_PROVIDED) unless field.present?
100
+
96
101
  values = title_values(field)
97
102
  [format_title(values[:title_or_form]), values[:punctuation], values[:other_info]].compact_blank.join(' ')
98
103
  end
@@ -592,6 +592,12 @@ dentshils:
592
592
  - Health Sciences Libraries
593
593
  - Levy Dental Medicine Library
594
594
  display: Levy Dental Medicine Library - Shils Boardroom
595
+ dentwellrm:
596
+ specific_location: Levy Dental Medicine Library - Wellness Room
597
+ library:
598
+ - Health Sciences Libraries
599
+ - Levy Dental Medicine Library
600
+ display: Levy Dental Medicine Library - Wellness Room
595
601
  dncirc:
596
602
  specific_location: Levy Dental Medicine Library - Circulation
597
603
  library:
@@ -834,6 +840,10 @@ mideastres:
834
840
  - Van Pelt-Dietrich Library Center
835
841
  - Reserve
836
842
  display: Van Pelt - Middle East Seminar Reserve
843
+ mscirc:
844
+ specific_location: Penn Museum Library - Circulation
845
+ library: Penn Museum Library
846
+ display: Penn Museum Library - Circulation
837
847
  muse:
838
848
  specific_location: Penn Museum Library
839
849
  library: Penn Museum Library
@@ -861,6 +871,14 @@ museegypov:
861
871
  specific_location: Penn Museum Library - Egyptian Oversize
862
872
  library: Penn Museum Library
863
873
  display: Penn Museum Library - Egyptian Oversize
874
+ museexhi:
875
+ specific_location: Penn Museum Library - Exhibition
876
+ library: Penn Museum Library
877
+ display: Penn Museum Library - Exhibition
878
+ musefolio:
879
+ specific_location: Penn Museum Library - Folio
880
+ library: Penn Museum Library
881
+ display: Penn Museum Library - Folio
864
882
  musekolb:
865
883
  specific_location: Penn Museum Library - Kolb
866
884
  library: Penn Museum Library
@@ -876,10 +894,14 @@ musemedia:
876
894
  specific_location: Penn Museum Library - Media
877
895
  library: Penn Museum Library
878
896
  display: Penn Museum Library - Media
879
- musenewbk:
897
+ musenewbks:
880
898
  specific_location: Penn Museum Library - New Books Display
881
899
  library: Penn Museum Library
882
900
  display: Penn Museum Library - New Books Display
901
+ museover:
902
+ specific_location: Penn Museum Library - Oversize
903
+ library: Penn Museum Library
904
+ display: Penn Museum Library - Oversize
883
905
  muserefe:
884
906
  specific_location: Penn Museum Library - Reference
885
907
  library: Penn Museum Library
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.2.3'
4
+ VERSION = '1.2.5'
5
5
  end
@@ -47,7 +47,7 @@ describe 'PennMARC::Genre' do
47
47
  let(:fields) do
48
48
  [marc_control_field(tag: '007', value: 'x'),
49
49
  marc_field(tag: 'hld', subfields: { c: 'vanp' }),
50
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Genre.' })]
50
+ marc_field(tag: '655', indicator2: '0', subfields: { a: 'Genre.' })]
51
51
  end
52
52
 
53
53
  it 'returns no genre values for faceting' do
@@ -59,11 +59,13 @@ describe 'PennMARC::Genre' do
59
59
  let(:fields) do
60
60
  [marc_control_field(tag: '007', value: 'v'),
61
61
  marc_field(tag: 'hld', subfields: { c: 'vanp' }),
62
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Documentary films' }),
63
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Sports' })]
62
+ marc_field(tag: '655', indicator2: '0', subfields: { a: 'Documentary films' }),
63
+ marc_field(tag: '655', indicator2: '7', subfields: { a: 'Sports', '2': 'fast' }),
64
+ marc_field(tag: '655', indicator2: '7', subfields: { a: 'Le cyclisme', '2': 'qlsp' }), # excluded due to sf2
65
+ marc_field(tag: '655', indicator2: '1', subfields: { a: 'Shredding' })] # excluded, invalid indicator value
64
66
  end
65
67
 
66
- it 'contains the expected genre facet values' do
68
+ it 'contains only the desired genre facet values' do
67
69
  expect(values).to contain_exactly 'Documentary films', 'Sports'
68
70
  end
69
71
  end
@@ -72,7 +74,7 @@ describe 'PennMARC::Genre' do
72
74
  let(:record) { marc_record fields: fields, leader: ' t' }
73
75
  let(:fields) do
74
76
  [marc_control_field(tag: '007', value: 'x'),
75
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Astronomy', '2': 'zzzz' })]
77
+ marc_field(tag: '655', indicator2: '7', subfields: { a: 'Astronomy', '2': 'fast' })]
76
78
  end
77
79
 
78
80
  it 'returns the expected genre values' do
@@ -16,6 +16,16 @@ describe 'PennMARC::Relation' do
16
16
  end
17
17
  end
18
18
 
19
+ describe '.contained_in_related_parts_show' do
20
+ let(:fields) do
21
+ [marc_field(tag: '773', subfields: { g: 'Vol. 24, pt. B no. 9 (Sept. 1993)', q: '24:B:9<235' })]
22
+ end
23
+
24
+ it 'returns only the specified subfields' do
25
+ expect(helper.contained_in_related_parts_show(record)).to eq ['Vol. 24, pt. B no. 9 (Sept. 1993)']
26
+ end
27
+ end
28
+
19
29
  describe '.chronology_show' do
20
30
  let(:fields) do
21
31
  [marc_field(tag: '650', indicator2: '4', subfields: { a: 'CHR Heading' }),
@@ -2,13 +2,14 @@
2
2
 
3
3
  describe 'PennMARC::Title' do
4
4
  let(:helper) { PennMARC::Title }
5
+ let(:leader) { nil }
6
+ let(:fields) { [marc_field(tag: '245', subfields: subfields)] }
7
+ let(:record) { marc_record fields: fields, leader: leader }
5
8
 
6
9
  describe '.search' do
7
- let(:record) do
8
- marc_record fields: [
9
- marc_field(tag: '245', subfields: { a: 'Title', b: 'Subtitle', c: 'Responsibility', h: 'Medium' }),
10
- marc_field(tag: '880', subfields: { a: 'Linked Title', '6': '245' })
11
- ]
10
+ let(:fields) do
11
+ [marc_field(tag: '245', subfields: { a: 'Title', b: 'Subtitle', c: 'Responsibility', h: 'Medium' }),
12
+ marc_field(tag: '880', subfields: { a: 'Linked Title', '6': '245' })]
12
13
  end
13
14
 
14
15
  it 'returns search values without ǂc or ǂh content' do
@@ -20,16 +21,14 @@ describe 'PennMARC::Title' do
20
21
 
21
22
  describe '.search_aux' do
22
23
  let(:leader) { 'ZZZZZnaaZa22ZZZZZzZZ4500' }
23
- let(:record) do
24
- marc_record fields: [
25
- marc_field(tag: '130', subfields: { a: 'Uniform Title', c: '130 not included' }),
26
- marc_field(tag: '880', subfields: { '6': '130', a: 'Alternative Uniform Title' }),
27
- marc_field(tag: '773', subfields: { a: 'Host Uniform Title', s: '773 not included' }),
28
- marc_field(tag: '700', subfields: { t: 'Personal Entry Title', s: '700 not included' }),
29
- marc_field(tag: '505', subfields: { t: 'Invalid Formatted Contents Note Title' }, indicator1: 'invalid'),
30
- marc_field(tag: '505', subfields: { t: 'Formatted Contents Note Title', s: '505 not included' },
31
- indicator1: '0', indicator2: '0')
32
- ], leader: leader
24
+ let(:fields) do
25
+ [marc_field(tag: '130', subfields: { a: 'Uniform Title', c: '130 not included' }),
26
+ marc_field(tag: '880', subfields: { '6': '130', a: 'Alternative Uniform Title' }),
27
+ marc_field(tag: '773', subfields: { a: 'Host Uniform Title', s: '773 not included' }),
28
+ marc_field(tag: '700', subfields: { t: 'Personal Entry Title', s: '700 not included' }),
29
+ marc_field(tag: '505', subfields: { t: 'Invalid Formatted Contents Note Title' }, indicator1: 'invalid'),
30
+ marc_field(tag: '505', subfields: { t: 'Formatted Contents Note Title', s: '505 not included' },
31
+ indicator1: '0', indicator2: '0')]
33
32
  end
34
33
 
35
34
  it 'returns auxiliary titles' do
@@ -51,12 +50,10 @@ describe 'PennMARC::Title' do
51
50
 
52
51
  describe '.journal_search' do
53
52
  let(:leader) { 'ZZZZZnasZa22ZZZZZzZZ4500' }
54
- let(:record) do
55
- marc_record fields: [
56
- marc_field(tag: '245', subfields: { a: 'Some Journal Title' }),
57
- marc_field(tag: '880', subfields: { a: 'Alternative Script', '6': '245' }),
58
- marc_field(tag: '880', subfields: { a: 'Unrelated 880', '6': 'invalid' })
59
- ], leader: leader
53
+ let(:fields) do
54
+ [marc_field(tag: '245', subfields: { a: 'Some Journal Title' }),
55
+ marc_field(tag: '880', subfields: { a: 'Alternative Script', '6': '245' }),
56
+ marc_field(tag: '880', subfields: { a: 'Unrelated 880', '6': 'invalid' })]
60
57
  end
61
58
 
62
59
  it 'returns journal search titles' do
@@ -74,16 +71,14 @@ describe 'PennMARC::Title' do
74
71
 
75
72
  describe '.journal_search_aux' do
76
73
  let(:leader) { 'ZZZZZnasZa22ZZZZZzZZ4500' }
77
- let(:record) do
78
- marc_record fields: [
79
- marc_field(tag: '130', subfields: { a: 'Uniform Title', c: '130 not included' }),
80
- marc_field(tag: '880', subfields: { '6': '130', a: 'Alternative Uniform Title' }),
81
- marc_field(tag: '773', subfields: { a: 'Host Uniform Title', s: '773 not included' }),
82
- marc_field(tag: '700', subfields: { t: 'Personal Entry Title', s: '700 not included' }),
83
- marc_field(tag: '505', subfields: { t: 'Invalid Formatted Contents Note Title' }, indicator1: 'invalid'),
84
- marc_field(tag: '505', subfields: { t: 'Formatted Contents Note Title', s: '505 not included' },
85
- indicator1: '0', indicator2: '0')
86
- ], leader: leader
74
+ let(:fields) do
75
+ [marc_field(tag: '130', subfields: { a: 'Uniform Title', c: '130 not included' }),
76
+ marc_field(tag: '880', subfields: { '6': '130', a: 'Alternative Uniform Title' }),
77
+ marc_field(tag: '773', subfields: { a: 'Host Uniform Title', s: '773 not included' }),
78
+ marc_field(tag: '700', subfields: { t: 'Personal Entry Title', s: '700 not included' }),
79
+ marc_field(tag: '505', subfields: { t: 'Invalid Formatted Contents Note Title' }, indicator1: 'invalid'),
80
+ marc_field(tag: '505', subfields: { t: 'Formatted Contents Note Title', s: '505 not included' },
81
+ indicator1: '0', indicator2: '0')]
87
82
  end
88
83
 
89
84
  it 'returns auxiliary journal search titles' do
@@ -102,9 +97,19 @@ describe 'PennMARC::Title' do
102
97
  end
103
98
 
104
99
  describe '.show' do
105
- let(:record) { marc_record fields: [marc_field(tag: '245', subfields: subfields)] }
100
+ context 'with no 245' do
101
+ let(:fields) do
102
+ # Simulate a miscoded record
103
+ [marc_field(tag: '246', indicator1: '1', indicator2: '4', subfields: { a: 'The horn concertos', c: 'Mozart' })]
104
+ end
105
+
106
+ it 'returns default title' do
107
+ expect(helper.show(record)).to eq [PennMARC::Title::NO_TITLE_PROVIDED]
108
+ end
109
+ end
106
110
 
107
111
  context 'with ǂa, ǂk and ǂn defined' do
112
+ let(:fields) { [marc_field(tag: '245', subfields: subfields)] }
108
113
  let(:subfields) { { a: 'Five Decades of MARC usage', k: 'journals', n: 'Part One' } }
109
114
 
110
115
  it 'returns single title value with text from ǂa and ǂn but not ǂk' do
@@ -113,6 +118,7 @@ describe 'PennMARC::Title' do
113
118
  end
114
119
 
115
120
  context 'with no ǂa but a ǂk and ǂn defined' do
121
+ let(:fields) { [marc_field(tag: '245', subfields: subfields)] }
116
122
  let(:subfields) { { k: 'journals', n: 'Part One' } }
117
123
 
118
124
  it 'returns single title value with text from ǂk and ǂn' do
@@ -140,10 +146,8 @@ describe 'PennMARC::Title' do
140
146
 
141
147
  describe '.detailed_show' do
142
148
  context 'with subfields ǂk, ǂf and ǂc' do
143
- let(:record) do
144
- marc_record fields: [
145
- marc_field(tag: '245', subfields: { k: 'Letters,', f: '1972-1982,', b: 'to Lewis Mumford.' })
146
- ]
149
+ let(:fields) do
150
+ [marc_field(tag: '245', subfields: { k: 'Letters,', f: '1972-1982,', b: 'to Lewis Mumford.' })]
147
151
  end
148
152
 
149
153
  it 'returns detailed title values' do
@@ -152,10 +156,8 @@ describe 'PennMARC::Title' do
152
156
  end
153
157
 
154
158
  context 'with subfields ǂk and ǂb' do
155
- let(:record) do
156
- marc_record fields: [
157
- marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford.' })
158
- ]
159
+ let(:fields) do
160
+ [marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford.' })]
159
161
  end
160
162
 
161
163
  it 'returns title value without dates' do
@@ -165,12 +167,10 @@ describe 'PennMARC::Title' do
165
167
 
166
168
  # e.g., 9977704838303681
167
169
  context 'with ǂa containing an " : " as well as inclusive dates' do
168
- let(:record) do
169
- marc_record fields: [
170
- marc_field(tag: '245', subfields: { a: 'The frugal housewife : ',
171
- b: 'dedicated to those who are not ashamed of economy, ',
172
- f: '1830 / ', c: 'by the author of Hobomok.' })
173
- ]
170
+ let(:fields) do
171
+ [marc_field(tag: '245', subfields: { a: 'The frugal housewife : ',
172
+ b: 'dedicated to those who are not ashamed of economy, ',
173
+ f: '1830 / ', c: 'by the author of Hobomok.' })]
174
174
  end
175
175
 
176
176
  it 'returns single title value with text from ǂa and ǂn' do
@@ -182,11 +182,9 @@ describe 'PennMARC::Title' do
182
182
  end
183
183
 
184
184
  describe '.alternate_show' do
185
- let(:record) do
186
- marc_record fields: [
187
- marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' }),
188
- marc_field(tag: '880', subfields: { '6': '245', k: 'Lettres', b: 'à Lewis Mumford.' })
189
- ]
185
+ let(:fields) do
186
+ [marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' }),
187
+ marc_field(tag: '880', subfields: { '6': '245', k: 'Lettres', b: 'à Lewis Mumford.' })]
190
188
  end
191
189
 
192
190
  context 'with subfields ǂk and ǂb' do
@@ -196,10 +194,8 @@ describe 'PennMARC::Title' do
196
194
  end
197
195
 
198
196
  context 'when 880 field is not present' do
199
- let(:record) do
200
- marc_record fields: [
201
- marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' })
202
- ]
197
+ let(:fields) do
198
+ [marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' })]
203
199
  end
204
200
 
205
201
  it 'returns nil' do
@@ -210,10 +206,9 @@ describe 'PennMARC::Title' do
210
206
 
211
207
  describe '.sort' do
212
208
  context 'with no 245' do
213
- let(:record) do
209
+ let(:fields) do
214
210
  # Simulate a miscoded record
215
- marc_record fields: [marc_field(tag: '246', indicator1: '1', indicator2: '4',
216
- subfields: { a: 'The horn concertos', c: 'Mozart' })]
211
+ [marc_field(tag: '246', indicator1: '1', indicator2: '4', subfields: { a: 'The horn concertos', c: 'Mozart' })]
217
212
  end
218
213
 
219
214
  it 'returns nil' do
@@ -222,14 +217,12 @@ describe 'PennMARC::Title' do
222
217
  end
223
218
 
224
219
  context 'with a record with a valid indicator2 value' do
225
- let(:record) do
226
- marc_record fields: [
227
- marc_field(tag: '245', indicator2: '4', subfields: {
228
- a: 'The Record Title',
229
- b: 'Remainder', n: 'Number', p: 'Section',
230
- h: 'Do not display'
231
- })
232
- ]
220
+ let(:fields) do
221
+ [marc_field(tag: '245', indicator2: '4', subfields: {
222
+ a: 'The Record Title',
223
+ b: 'Remainder', n: 'Number', p: 'Section',
224
+ h: 'Do not display'
225
+ })]
233
226
  end
234
227
 
235
228
  it 'properly removes and appends the number of characters specified in indicator 2' do
@@ -244,8 +237,8 @@ describe 'PennMARC::Title' do
244
237
  end
245
238
 
246
239
  context 'with a record with no indicator2 value' do
247
- let(:record) do
248
- marc_record fields: [marc_field(tag: '245', subfields: { a: 'The Record Title' })]
240
+ let(:fields) do
241
+ [marc_field(tag: '245', subfields: { a: 'The Record Title' })]
249
242
  end
250
243
 
251
244
  it 'does not transform the title value' do
@@ -254,9 +247,7 @@ describe 'PennMARC::Title' do
254
247
  end
255
248
 
256
249
  context 'with a record with no ǂa and no indicator2 value' do
257
- let(:record) do
258
- marc_record fields: [marc_field(tag: '245', subfields: { k: 'diaries' })]
259
- end
250
+ let(:fields) { [marc_field(tag: '245', subfields: { k: 'diaries' })] }
260
251
 
261
252
  it 'uses ǂk (form) value without transformation' do
262
253
  expect(helper.sort(record)).to eq 'diaries'
@@ -264,9 +255,7 @@ describe 'PennMARC::Title' do
264
255
  end
265
256
 
266
257
  context 'with a record with a leading bracket' do
267
- let(:record) do
268
- marc_record fields: [marc_field(tag: '245', subfields: { a: '[The Record Title]' })]
269
- end
258
+ let(:fields) { [marc_field(tag: '245', subfields: { a: '[The Record Title]' })] }
270
259
 
271
260
  # TODO: is this the expected behavior? It would sort right, but looks silly.
272
261
  it 'removes the leading bracket and appends it to the full value' do
@@ -276,17 +265,15 @@ describe 'PennMARC::Title' do
276
265
  end
277
266
 
278
267
  describe '.standardized_show' do
279
- let(:record) do
280
- marc_record fields: [
281
- marc_field(tag: '130', subfields: { a: 'Uniform Title', f: '2000', '8': 'Not Included' }),
282
- marc_field(tag: '240', subfields: { a: 'Another Uniform Title', '0': 'Ugly Control Number' }),
283
- marc_field(tag: '730', indicator2: '', subfields: { a: 'Yet Another Uniform Title' }),
284
- marc_field(tag: '730', indicator1: '0', indicator2: '2', subfields: { a: 'Not Printed Title' }),
285
- marc_field(tag: '730', indicator1: '', subfields: { i: 'Subfield i Title' }),
286
- marc_field(tag: '880', subfields: { '6': '240', a: 'Translated Uniform Title' }),
287
- marc_field(tag: '880', subfields: { '6': '730', a: 'Alt Ignore', i: 'Alt Subfield i' }),
288
- marc_field(tag: '880', subfields: { '6': '100', a: 'Alt Ignore' })
289
- ]
268
+ let(:fields) do
269
+ [marc_field(tag: '130', subfields: { a: 'Uniform Title', f: '2000', '8': 'Not Included' }),
270
+ marc_field(tag: '240', subfields: { a: 'Another Uniform Title', '0': 'Ugly Control Number' }),
271
+ marc_field(tag: '730', indicator2: '', subfields: { a: 'Yet Another Uniform Title' }),
272
+ marc_field(tag: '730', indicator1: '0', indicator2: '2', subfields: { a: 'Not Printed Title' }),
273
+ marc_field(tag: '730', indicator1: '', subfields: { i: 'Subfield i Title' }),
274
+ marc_field(tag: '880', subfields: { '6': '240', a: 'Translated Uniform Title' }),
275
+ marc_field(tag: '880', subfields: { '6': '730', a: 'Alt Ignore', i: 'Alt Subfield i' }),
276
+ marc_field(tag: '880', subfields: { '6': '100', a: 'Alt Ignore' })]
290
277
  end
291
278
 
292
279
  it 'returns the expected standardized title display values' do
@@ -299,13 +286,11 @@ describe 'PennMARC::Title' do
299
286
  end
300
287
 
301
288
  describe '.other_show' do
302
- let(:record) do
303
- marc_record fields: [
304
- marc_field(tag: '246', subfields: { a: 'Varied Title', f: '2000', '8': 'Not Included' }),
305
- marc_field(tag: '740', indicator2: '0', subfields: { a: 'Uncontrolled Title', '5': 'Penn' }),
306
- marc_field(tag: '740', indicator2: '2', subfields: { a: 'A Title We Do Not Like' }),
307
- marc_field(tag: '880', subfields: { '6': '246', a: 'Alternate Varied Title' })
308
- ]
289
+ let(:fields) do
290
+ [marc_field(tag: '246', subfields: { a: 'Varied Title', f: '2000', '8': 'Not Included' }),
291
+ marc_field(tag: '740', indicator2: '0', subfields: { a: 'Uncontrolled Title', '5': 'Penn' }),
292
+ marc_field(tag: '740', indicator2: '2', subfields: { a: 'A Title We Do Not Like' }),
293
+ marc_field(tag: '880', subfields: { '6': '246', a: 'Alternate Varied Title' })]
309
294
  end
310
295
 
311
296
  it 'returns the expected other title display values' do
@@ -316,11 +301,9 @@ describe 'PennMARC::Title' do
316
301
  end
317
302
 
318
303
  describe '.former_show' do
319
- let(:record) do
320
- marc_record fields: [
321
- marc_field(tag: '247', subfields: { a: 'Former Title', n: 'Part', '6': 'Linkage', e: 'Append' }),
322
- marc_field(tag: '880', subfields: { a: 'Alt Title', n: 'Part', '6': '247' })
323
- ]
304
+ let(:fields) do
305
+ [marc_field(tag: '247', subfields: { a: 'Former Title', n: 'Part', '6': 'Linkage', e: 'Append' }),
306
+ marc_field(tag: '880', subfields: { a: 'Alt Title', n: 'Part', '6': '247' })]
324
307
  end
325
308
 
326
309
  it 'returns the expected former title value' do
@@ -331,7 +314,7 @@ describe 'PennMARC::Title' do
331
314
  end
332
315
 
333
316
  describe '.host_bib_record?' do
334
- let(:record) { marc_record fields: [marc_field(tag: '245', subfields: subfields)] }
317
+ let(:fields) { [marc_field(tag: '245', subfields: subfields)] }
335
318
 
336
319
  context 'with a host record' do
337
320
  let(:subfields) { { a: "#{PennMARC::Title::HOST_BIB_TITLE} for 123456789" } }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pennmarc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kanning
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2024-10-29 00:00:00.000000000 Z
15
+ date: 2024-12-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -81,6 +81,7 @@ files:
81
81
  - ".gitignore"
82
82
  - ".gitlab-ci.yml"
83
83
  - ".gitleaks.toml"
84
+ - ".pipeline.yml"
84
85
  - ".rspec"
85
86
  - ".rubocop.yml"
86
87
  - ".rubocop_todo.yml"