Skip to content

Commit

Permalink
support registration of subject metadata. #228
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 9, 2019
1 parent 27f33e7 commit e9b28bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
23 changes: 23 additions & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/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) }
Expand Down

0 comments on commit e9b28bc

Please sign in to comment.