stanford-mods 1.5.2 → 1.5.3

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.
@@ -156,7 +156,7 @@ SPOTLIGHT_PUB_DATE_DATA = {
156
156
  mods_origin_info_start_str +
157
157
  '<dateIssued encoding="marc" point="start" keyDate="yes">0850</dateIssued>' +
158
158
  '<dateIssued encoding="marc" point="end">1499</dateIssued>' +
159
- mods_origin_info_end_str => ['0850', '850'],
159
+ mods_origin_info_end_str => ['0850', '850 A.D.'],
160
160
  # nc881qb8504
161
161
  mods_origin_info_start_str +
162
162
  '<dateCreated point="start" qualifier="approximate" keyDate="yes">1000</dateCreated>' +
@@ -79,8 +79,8 @@ describe "computations from /originInfo field" do
79
79
  end
80
80
  end
81
81
 
82
- context '#pub_date_facet_single_value' do
83
- it_behaves_like "single pub date value", :pub_date_facet_single_value, 1
82
+ context '#pub_year_display_str' do
83
+ it_behaves_like "single pub date value", :pub_year_display_str, 1
84
84
  end
85
85
 
86
86
  context '#pub_year_sort_str' do
@@ -226,14 +226,14 @@ describe "computations from /originInfo field" do
226
226
  end
227
227
  end
228
228
 
229
- context '#year_facet_str' do
230
- it_behaves_like "pub date best single value", :year_facet_str
229
+ context '#year_display_str' do
230
+ it_behaves_like "pub date best single value", :year_display_str
231
231
  it 'uses facet value, not sorting value' do
232
232
  mods_str = mods_origin_info_start_str +
233
233
  '<dateCreated keyDate="yes">180 B.C.</dateCreated>' +
234
234
  mods_origin_info_end_str
235
235
  smods_rec.from_str(mods_str)
236
- expect(smods_rec.year_facet_str(smods_rec.date_created_elements)).to eq '180 B.C.'
236
+ expect(smods_rec.year_display_str(smods_rec.date_created_elements)).to eq '180 B.C.'
237
237
  end
238
238
  end
239
239
 
@@ -622,6 +622,11 @@ describe "Format fields (searchworks.rb)" do
622
622
  @smods_rec.from_str(m)
623
623
  expect(@smods_rec.sw_genre).to eq ['Technical report']
624
624
  end
625
+ it "it does not include Archived website: typeOfResource 'text', genre 'archived website'" do
626
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">archived website</genre><typeOfResource>text</typeOfResource></mods>"
627
+ @smods_rec.from_str(m)
628
+ expect(@smods_rec.sw_genre).to_not eq ['Archived website']
629
+ end
625
630
  it "capitalizes the first letter of a genre value" do
626
631
  m = "<mods #{@ns_decl}><genre authority=\"marcgt\">student project report</genre></mods>"
627
632
  @smods_rec.from_str(m)
@@ -0,0 +1,29 @@
1
+ describe "SearchWorks Publication methods" do
2
+
3
+ let(:smods_rec) { Stanford::Mods::Record.new }
4
+ RSpec.shared_examples "pub year" do |method_sym, exp_val_position|
5
+ context 'searchworks actual data' do
6
+ require 'fixtures/searchworks_pub_date_data'
7
+ SEARCHWORKS_PUB_DATE_DATA.each_pair.each do |coll_name, coll_data|
8
+ coll_data.each_pair do |mods_str, exp_vals|
9
+ expected = exp_vals[exp_val_position]
10
+ # TODO: pub_year_display_str doesn't cope with date ranges yet
11
+ expected = expected.split(' - ')[0] if method_sym == :pub_year_display_str && expected
12
+ it "#{expected} for rec in #{coll_name}" do
13
+ smods_rec.from_str(mods_str)
14
+ expect(smods_rec.send(method_sym)).to eq expected
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ context '#pub_year_int' do
22
+ it_behaves_like "pub year", :pub_year_int, 0
23
+ end
24
+
25
+ context '#pub_year_display_str' do
26
+ it_behaves_like "pub year", :pub_year_display_str, 1
27
+ end
28
+
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stanford-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-04 00:00:00.000000000 Z
12
+ date: 2016-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mods
@@ -131,6 +131,7 @@ files:
131
131
  - lib/stanford-mods/searchworks_subjects.rb
132
132
  - lib/stanford-mods/version.rb
133
133
  - spec/date_parsing_spec.rb
134
+ - spec/fixtures/searchworks_pub_date_data.rb
134
135
  - spec/fixtures/spotlight_pub_date_data.rb
135
136
  - spec/geo_spatial_spec.rb
136
137
  - spec/lib/stanford-mods/coordinate_spec.rb
@@ -145,6 +146,7 @@ files:
145
146
  - spec/searchworks_subject_spec.rb
146
147
  - spec/searchworks_title_spec.rb
147
148
  - spec/spec_helper.rb
149
+ - spec/sw_publication_spec.rb
148
150
  - stanford-mods.gemspec
149
151
  homepage: https://github.com/sul-dlss/stanford-mods
150
152
  licenses: []
@@ -165,12 +167,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
167
  version: '0'
166
168
  requirements: []
167
169
  rubyforge_project:
168
- rubygems_version: 2.4.8
170
+ rubygems_version: 2.4.5.1
169
171
  signing_key:
170
172
  specification_version: 4
171
173
  summary: Stanford specific wrangling of MODS metadata
172
174
  test_files:
173
175
  - spec/date_parsing_spec.rb
176
+ - spec/fixtures/searchworks_pub_date_data.rb
174
177
  - spec/fixtures/spotlight_pub_date_data.rb
175
178
  - spec/geo_spatial_spec.rb
176
179
  - spec/lib/stanford-mods/coordinate_spec.rb
@@ -185,4 +188,5 @@ test_files:
185
188
  - spec/searchworks_subject_spec.rb
186
189
  - spec/searchworks_title_spec.rb
187
190
  - spec/spec_helper.rb
191
+ - spec/sw_publication_spec.rb
188
192
  has_rdoc: