Skip to content

Commit

Permalink
Merge pull request #4372 from sul-dlss/bump-cocina-0.87.0
Browse files Browse the repository at this point in the history
Update cocina-models to 0.87.0 (for Folio record ID support)
  • Loading branch information
aaron-collier authored Feb 14, 2023
2 parents f3db787 + 227c004 commit 7f19e40
Show file tree
Hide file tree
Showing 8 changed files with 409 additions and 360 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '~> 7.0'

# DLSS/domain-specific dependencies
gem 'cocina-models', '~> 0.86.0'
gem 'cocina-models', '~> 0.87.0'
gem 'datacite', '~> 0.3.0'
gem 'dor-workflow-client', '~> 5.0'
gem 'druid-tools', '~> 2.2'
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ GEM
capistrano-bundler (>= 1.1, < 3)
capistrano-shared_configs (0.2.2)
chronic (0.10.2)
cocina-models (0.86.0)
cocina-models (0.87.0)
activesupport
deprecation
dry-struct (~> 1.0)
Expand Down Expand Up @@ -282,12 +282,12 @@ GEM
net-protocol
net-ssh (7.0.1)
nio4r (2.5.8)
nokogiri (1.14.1)
nokogiri (1.14.2)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.14.1-x86_64-darwin)
nokogiri (1.14.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.14.1-x86_64-linux)
nokogiri (1.14.2-x86_64-linux)
racc (~> 1.4)
nokogiri-happymapper (0.9.0)
nokogiri (~> 1.5)
Expand Down Expand Up @@ -488,7 +488,7 @@ DEPENDENCIES
capistrano-passenger
capistrano-rails
capistrano-shared_configs
cocina-models (~> 0.86.0)
cocina-models (~> 0.87.0)
committee (~> 4.4)
config
datacite (~> 0.3.0)
Expand Down
727 changes: 388 additions & 339 deletions openapi.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe 'Cocina --> DataCite mappings for identifier and alternateIdentifier (H2 specific)' do
# NOTE: Because we haven't set a title in this Cocina::Models::Description, it will not validate against the openapi.
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/aa666bb1234')), false, false) }
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/gz708sf9862')), false, false) }
let(:identifier_attributes) { Cocina::ToDatacite::Identifier.identifier_attributes(cocina_description) }
let(:alternate_identifier_attributes) { Cocina::ToDatacite::Identifier.alternate_identifier_attributes(cocina_description) }

Expand Down Expand Up @@ -32,17 +32,17 @@
end

describe 'purl' do
# purl: http://purl.stanford.edu/gz708sf9862
# purl: https://purl.stanford.edu/gz708sf9862
let(:cocina) do
{
purl: 'http://purl.stanford.edu/gz708sf9862'
purl: 'https://purl.stanford.edu/gz708sf9862'
}
end

it 'populates alternate_identifier_attributes correctly' do
expect(alternate_identifier_attributes).to eq [
{
alternateIdentifier: 'http://purl.stanford.edu/gz708sf9862',
alternateIdentifier: 'https://purl.stanford.edu/gz708sf9862',
alternateIdentifierType: 'PURL'
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe 'Cocina --> DataCite mappings for note' do
# NOTE: Because we haven't set a title in this Cocina::Models::Description, it will not validate against the openapi.
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/aa666bb1234')), false, false) }
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/gz708sf9862')), false, false) }
let(:descriptions_attributes) { Cocina::ToDatacite::Note.descriptions_attributes(cocina_description) }

describe 'Abstract' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# relatedItem attribute new in DataCite MetadataKerne schema v. 4.4 and not included in the DataCite ReST API docs as of 2021-07
RSpec.describe 'Cocina --> DataCite mappings for relatedItem' do
# NOTE: Because we haven't set a title in this Cocina::Models::Description, it will not validate against the openapi.
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/aa666bb1234')), false, false) }
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/gz708sf9862')), false, false) }
let(:related_item_attributes) { Cocina::ToDatacite::RelatedResource.related_item_attributes(cocina_description) }

describe 'Related citation' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe 'Cocina --> DataCite mappings for FAST subjects' do
# NOTE: Because we haven't set a title in this Cocina::Models::Description, it will not validate against the openapi.
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/aa666bb1234')), false, false) }
let(:cocina_description) { Cocina::Models::Description.new(cocina.merge(purl: cocina.fetch(:purl, 'https://purl.stanford.edu/gz708sf9862')), false, false) }
let(:subjects_attributes) { Cocina::ToDatacite::Subject.subjects_attributes(cocina_description) }

describe 'FAST topic' do
Expand Down
16 changes: 8 additions & 8 deletions spec/services/refresh_metadata_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
end

describe '#identifiers' do
subject(:indentifiers) { described_class.identifiers(cocina_object:) }
subject(:identifiers) { described_class.identifiers(cocina_object:) }

let(:identification) { instance_double(Cocina::Models::RequestIdentification, catalogLinks: catalog_links) }
let(:cocina_object) do
Expand All @@ -86,31 +86,31 @@

context 'when a valid identifier' do
let(:catalog_links) do
[Cocina::Models::CatalogLink.new(catalog: 'symphony', catalogRecordId: 'nope123', refresh: false),
Cocina::Models::CatalogLink.new(catalog: 'symphony', catalogRecordId: 'yup123', refresh: true),
Cocina::Models::CatalogLink.new(catalog: 'previous symphony', catalogRecordId: 'old123', refresh: true)]
[Cocina::Models::CatalogLink[catalog: 'folio', catalogRecordId: 'a123', refresh: false],
Cocina::Models::CatalogLink[catalog: 'symphony', catalogRecordId: '123', refresh: true],
Cocina::Models::CatalogLink[catalog: 'previous symphony', catalogRecordId: '1234', refresh: true]]
end

it 'returns only the valid symphony identifier with refresh == true' do
expect(indentifiers).to eq(['catkey:yup123'])
expect(identifiers).to eq(['catkey:123'])
end
end

context 'when no identifiers' do
let(:catalog_links) { [] }

it 'returns an empty array' do
expect(indentifiers).to eq([])
expect(identifiers).to eq([])
end
end

context 'when no valid identifiers' do
let(:catalog_links) do
[Cocina::Models::CatalogLink.new(catalog: 'symphony', catalogRecordId: 'nope123', refresh: false)]
[Cocina::Models::CatalogLink[catalog: 'previous folio', catalogRecordId: 'in123', refresh: false]]
end

it 'returns an empty array' do
expect(indentifiers).to eq([])
expect(identifiers).to eq([])
end
end
end
Expand Down

0 comments on commit 7f19e40

Please sign in to comment.