Skip to content

Commit

Permalink
support language attribute for rights_list. #226
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 9, 2019
1 parent 5036c3b commit 27f33e7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def safe_params
:descriptions,
{ descriptions: [:description, :descriptionType, :lang] },
:rightsList,
{ rightsList: [:rights, :rightsUri] },
{ rightsList: [:rights, :rightsUri, :lang] },
:xml,
:regenerate,
:source,
Expand All @@ -510,9 +510,9 @@ def safe_params
:should_validate,
:client,
:creators,
{ creators: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation] },
{ creators: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :lang] },
:contributors,
{ contributors: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :contributorType] },
{ contributors: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :contributorType, :lang] },
:identifiers,
{ identifiers: [:identifier, :identifierType] },
:relatedIdentifiers,
Expand Down
20 changes: 20 additions & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,26 @@
# end
end

context 'update rightsList' do
let(:rights_list) { [{ "rights" => "Creative Commons Attribution 3.0", "rightsUri" => "http://creativecommons.org/licenses/by/3.0/", "lang" => "en"}] }
let(:update_attributes) do
{
"data" => {
"type" => "dois",
"attributes" => {
"rightsList" => rights_list
}
}
}
end

before { patch "/dois/#{doi.doi}", params: update_attributes.to_json, headers: headers }

it 'updates the Doi' do
expect(json.dig('data', 'attributes', 'rightsList')).to eq(rights_list)
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 27f33e7

Please sign in to comment.