From 4a6f4392739afda05617c581f4f2b08382ad440c Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Wed, 6 Dec 2023 10:14:02 -0500 Subject: [PATCH 1/3] Update to bolognese 2.0.2. Revert json-canonicalization to 0.3.1. Add forgotten test. --- Gemfile | 2 +- Gemfile.lock | 6 +++--- spec/requests/datacite_dois_spec.rb | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 81f660188..90ffe6389 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem "aws-sdk-sqs", "~> 1.3" gem "base32-url", "~> 0.3" gem "batch-loader", "~> 1.4", ">= 1.4.1" gem "bcrypt", "~> 3.1.7" -gem "bolognese", "~> 2.0.0" +gem "bolognese", "~> 2.0.2" gem "bootsnap", "~> 1.4", ">= 1.4.4", require: false gem "cancancan", "~> 3.0" gem "commonmarker", "~> 0.23.4" diff --git a/Gemfile.lock b/Gemfile.lock index 040c625be..381f4bb8e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -113,7 +113,7 @@ GEM latex-decode (~> 0.0) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bolognese (2.0.0) + bolognese (2.0.2) activesupport (>= 4.2.5) benchmark_methods (~> 0.7) bibtex-ruby (>= 5.1.0) @@ -296,7 +296,7 @@ GEM iso8601 (0.9.1) jmespath (1.6.2) json (2.6.3) - json-canonicalization (0.3.2) + json-canonicalization (0.3.1) json-ld (3.2.3) htmlentities (~> 4.3) json-canonicalization (~> 0.3) @@ -656,7 +656,7 @@ DEPENDENCIES bcrypt (~> 3.1.7) better_errors binding_of_caller - bolognese (~> 2.0.0) + bolognese (~> 2.0.2) bootsnap (~> 1.4, >= 1.4.4) bullet (~> 6.1) byebug diff --git a/spec/requests/datacite_dois_spec.rb b/spec/requests/datacite_dois_spec.rb index 173678009..15008feb2 100755 --- a/spec/requests/datacite_dois_spec.rb +++ b/spec/requests/datacite_dois_spec.rb @@ -2983,13 +2983,14 @@ it "creates a Doi" do post "/dois", valid_attributes, headers - pp json + # pp json expect(last_response.status).to eq(201) expect(json.dig("data", "attributes", "doi")).to eq(doi) expect(json.dig("data", "attributes", "schemaVersion")).to eq("http://datacite.org/schema/kernel-4") expect(json.dig("data", "attributes", "state")).to eq("findable") expect(json.dig("data", "attributes", "publisher")).to eq("Example Publisher") + expect(json.dig("data", "attributes", "relatedIdentifiers", 34)).to eq( { "relatedIdentifier" => "10.1016/j.epsl.2011.11.037", @@ -3007,6 +3008,11 @@ } ) + expect(json.dig("data", "attributes", "relatedItems", 1, "relationType")).to eq("Collects") + expect(json.dig("data", "attributes", "relatedItems", 1, "titles", 0, "title")).to eq("Journal of Metadata Examples - Collects") + expect(json.dig("data", "attributes", "relatedItems", 2, "relationType")).to eq("IsCollectedBy") + expect(json.dig("data", "attributes", "relatedItems", 2, "titles", 0, "title")).to eq("Journal of Metadata Examples - IsCollectedBy") + doc = Nokogiri::XML(Base64.decode64(json.dig("data", "attributes", "xml")), nil, "UTF-8", &:noblanks) expect(doc.at_css("publisher").content).to eq("Example Publisher") expect(doc.at_css("publisher")["publisherIdentifier"]).to eq("https://ror.org/04z8jg394") From e28426b9c021d5c57a172501f1115c99be845dfe Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Wed, 6 Dec 2023 10:19:05 -0500 Subject: [PATCH 2/3] Remove comment. --- spec/requests/datacite_dois_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/requests/datacite_dois_spec.rb b/spec/requests/datacite_dois_spec.rb index 15008feb2..643ae8229 100755 --- a/spec/requests/datacite_dois_spec.rb +++ b/spec/requests/datacite_dois_spec.rb @@ -2983,7 +2983,6 @@ it "creates a Doi" do post "/dois", valid_attributes, headers - # pp json expect(last_response.status).to eq(201) expect(json.dig("data", "attributes", "doi")).to eq(doi) From ed026c2165317e7659021103924ee06133f832a2 Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Wed, 6 Dec 2023 10:29:44 -0500 Subject: [PATCH 3/3] Data for test mod. --- spec/fixtures/files/datacite-example-full-v4.5.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/files/datacite-example-full-v4.5.xml b/spec/fixtures/files/datacite-example-full-v4.5.xml index b6642a58f..21e45871e 100644 --- a/spec/fixtures/files/datacite-example-full-v4.5.xml +++ b/spec/fixtures/files/datacite-example-full-v4.5.xml @@ -223,7 +223,7 @@ 1234-5678 - + ExampleFamilyName, ExampleGivenName ExampleGivenName @@ -250,6 +250,18 @@ + + 1234-5678 + + Journal of Metadata Examples - Collects + + + + 0123-4567 + + Journal of Metadata Examples - IsCollectedBy + + \ No newline at end of file