stanford-mods 2.6.0 → 2.6.4

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.
@@ -27,6 +27,19 @@ describe 'title fields (searchworks.rb)' do
27
27
  end
28
28
  end
29
29
 
30
+ context 'when titleInfo contains a subTitle but no title' do
31
+ let(:record) do
32
+ m = "<mods #{@ns_decl}><titleInfo><subTitle>An overview from 1942-1950</subTitle></titleInfo></mods>"
33
+ rec = Stanford::Mods::Record.new
34
+ rec.from_str m
35
+ rec
36
+ end
37
+
38
+ it 'returns nil' do
39
+ expect(record.sw_full_title).to be_nil
40
+ end
41
+ end
42
+
30
43
  context 'missing title node' do
31
44
  it 'deals with missing titleInfo node' do
32
45
  m = "<mods #{@ns_decl}></mods>"
@@ -80,6 +93,7 @@ describe 'title fields (searchworks.rb)' do
80
93
  expect(@smods_rec.sw_full_title).to eq 'The Olympics!'
81
94
  end
82
95
  end # no subtitle
96
+
83
97
  context 'subtitle' do
84
98
  it 'end title with a colon' do
85
99
  m = "<mods #{@ns_decl}>
@@ -123,6 +137,7 @@ describe 'title fields (searchworks.rb)' do
123
137
  expect(@smods_rec.sw_full_title).to eq 'The Olympics : a history?'
124
138
  end
125
139
  end # subtitle
140
+
126
141
  context 'partName' do
127
142
  context 'no partNumber' do
128
143
  it 'end partName with period' do
@@ -162,6 +177,7 @@ describe 'title fields (searchworks.rb)' do
162
177
  expect(@smods_rec.sw_full_title).to eq 'cfb. Appendix.'
163
178
  end
164
179
  end # no partNumber
180
+
165
181
  context 'partNumber' do
166
182
  it 'end partNumber with comma' do
167
183
  m = "<mods #{@ns_decl}>
@@ -205,6 +221,7 @@ describe 'title fields (searchworks.rb)' do
205
221
  end
206
222
  end
207
223
  end # partName
224
+
208
225
  context 'no partName, but partNumber' do
209
226
  it 'end partNumber with period' do
210
227
  m = "<mods #{@ns_decl}>
@@ -322,6 +339,7 @@ describe 'title fields (searchworks.rb)' do
322
339
  expect(@smods_rec.sw_title_display).to eq 'The Jerk'
323
340
  end
324
341
  end
342
+
325
343
  context 'no subtitle' do
326
344
  it 'end title with a period' do
327
345
  m = "<mods #{@ns_decl}>
@@ -351,6 +369,7 @@ describe 'title fields (searchworks.rb)' do
351
369
  expect(@smods_rec.sw_title_display).to eq 'The Olympics!'
352
370
  end
353
371
  end # no subtitle
372
+
354
373
  context 'subtitle' do
355
374
  it 'end title with a colon' do
356
375
  m = "<mods #{@ns_decl}>
@@ -394,6 +413,7 @@ describe 'title fields (searchworks.rb)' do
394
413
  expect(@smods_rec.sw_title_display).to eq 'The Olympics : a history?'
395
414
  end
396
415
  end # subtitle
416
+
397
417
  context 'partName' do
398
418
  context 'no partNumber' do
399
419
  it 'end partName with period' do
@@ -433,6 +453,7 @@ describe 'title fields (searchworks.rb)' do
433
453
  expect(@smods_rec.sw_title_display).to eq 'cfb. Appendix'
434
454
  end
435
455
  end # no partNumber
456
+
436
457
  context 'partNumber' do
437
458
  it 'end partNumber with comma' do
438
459
  m = "<mods #{@ns_decl}>
@@ -476,6 +497,7 @@ describe 'title fields (searchworks.rb)' do
476
497
  end
477
498
  end
478
499
  end # partName
500
+
479
501
  context 'no partName, but partNumber' do
480
502
  it 'end partNumber with period' do
481
503
  m = "<mods #{@ns_decl}>
@@ -544,6 +566,7 @@ describe 'title fields (searchworks.rb)' do
544
566
  @smods_rec.from_str(m)
545
567
  @addl_titles = @smods_rec.sw_addl_titles
546
568
  end
569
+
547
570
  it 'should not include the main title' do
548
571
  expect(@addl_titles.size).to eq 2
549
572
  expect(@addl_titles).not_to include(@smods_rec.sw_full_title)
@@ -563,6 +586,18 @@ describe 'title fields (searchworks.rb)' do
563
586
  @smods_rec.from_str(m)
564
587
  expect(@smods_rec.sw_addl_titles).to eq ['Alternative', 'Joke]']
565
588
  end
589
+ it 'excludes weird cases where there is no short title' do
590
+ m = <<-EOXML
591
+ <mods #{@ns_decl}>
592
+ <titleInfo></titleInfo>
593
+ <titleInfo type="alternative">
594
+ <title>Sponsored projects report for the year ended</title>
595
+ </titleInfo>
596
+ </mods>
597
+ EOXML
598
+ @smods_rec.from_str(m)
599
+ expect(@smods_rec.sw_addl_titles).to be_empty
600
+ end
566
601
  end
567
602
 
568
603
  context 'sort title' do
@@ -630,6 +665,7 @@ describe 'title fields (searchworks.rb)' do
630
665
  </titleInfo></mods>"
631
666
  @all_smods_rec.from_str(all)
632
667
  end
668
+
633
669
  it 'short titles' do
634
670
  expect(@mccarthy_smods_rec.sw_short_title).to eql 'McCarthy, John'
635
671
  expect(@insp_general_smods_rec.sw_short_title).to eql 'Semiannual report to Congress'
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ require 'simplecov'
2
+ SimpleCov.start
3
3
 
4
4
  require 'stanford-mods'
5
5
 
@@ -27,4 +27,7 @@ Gem::Specification.new do |gem|
27
27
  gem.add_development_dependency "yard"
28
28
  # tests
29
29
  gem.add_development_dependency 'rspec'
30
+ gem.add_development_dependency 'rubocop', '~> 0.60'
31
+ gem.add_development_dependency 'rubocop-rspec'
32
+ gem.add_development_dependency 'simplecov'
30
33
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stanford-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
8
8
  - Bess Sadler
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-17 00:00:00.000000000 Z
12
+ date: 2022-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mods
@@ -95,6 +95,48 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.60'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.60'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rubocop-rspec
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
98
140
  description: Stanford specific wrangling of MODS metadata from DOR, the Stanford Digital
99
141
  Object Repository
100
142
  email:
@@ -107,12 +149,12 @@ extra_rdoc_files:
107
149
  - README.md
108
150
  files:
109
151
  - ".coveralls.yml"
152
+ - ".github/workflows/ruby.yml"
110
153
  - ".gitignore"
111
154
  - ".hound.yml"
112
155
  - ".rspec"
113
156
  - ".rubocop.yml"
114
157
  - ".rubocop_todo.yml"
115
- - ".travis.yml"
116
158
  - ".yardopts"
117
159
  - Gemfile
118
160
  - LICENSE
@@ -155,7 +197,7 @@ files:
155
197
  homepage: https://github.com/sul-dlss/stanford-mods
156
198
  licenses: []
157
199
  metadata: {}
158
- post_install_message:
200
+ post_install_message:
159
201
  rdoc_options: []
160
202
  require_paths:
161
203
  - lib
@@ -170,9 +212,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
212
  - !ruby/object:Gem::Version
171
213
  version: '0'
172
214
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.6.11
175
- signing_key:
215
+ rubygems_version: 3.2.32
216
+ signing_key:
176
217
  specification_version: 4
177
218
  summary: Stanford specific wrangling of MODS metadata
178
219
  test_files:
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- script: rake
3
- rvm:
4
- - 2.4.4
5
- - 2.3.1
6
- # we used to use jruby for merged DOR + MARC records, but no more ...
7
- - jruby-9.2.0.0
8
- matrix:
9
- allow_failures:
10
- - rvm: jruby-9.2.0.0
11
- notifications: false
12
- sudo: false