diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index b67689457..ea9294324 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -464,6 +464,8 @@ def safe_params { types: [:resourceTypeGeneral, :resourceType, :schemaOrg, :bibtex, :citeproc, :ris] }, :dates, { dates: [:date, :dateType, :dateInformation] }, + :subjects, + { subjects: [:subject, :subjectScheme, :schemeUri, :valueUri, :lang] }, :landingPage, { landingPage: [ diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index f41ded754..7c07cafa2 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -1939,6 +1939,29 @@ end end + context 'update subjects' do + let(:subjects) { [{ "subject" => "80505 Web Technologies (excl. Web Search)", + "schemeUri" => "http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E", + "subjectScheme" => "FOR", + "lang" => "en" }] } + let(:update_attributes) do + { + "data" => { + "type" => "dois", + "attributes" => { + "subjects" => subjects + } + } + } + end + + before { patch "/dois/#{doi.doi}", params: update_attributes.to_json, headers: headers } + + it 'updates the Doi' do + expect(json.dig('data', 'attributes', 'subjects')).to eq(subjects) + end + end + context 'landing page' do let(:url) { "https://blog.datacite.org/re3data-science-europe/" } let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }