Skip to content

Commit

Permalink
fixed language in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 16, 2020
1 parent af295cf commit ed6a639
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/concerns/helpable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def register_url
end

unless match_url_with_domains(url: url, domains: client.domains)
raise ActionController::BadRequest.new(), "[Handle] Error updating DOI " + doi + ": URL not allowed by client domains settings."
raise ActionController::BadRequest.new(), "[Handle] Error updating DOI " + doi + ": URL not allowed by repository domains settings."
end

unless is_registered_or_findable?
Expand Down
6 changes: 3 additions & 3 deletions spec/concerns/helpable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@
it 'wrong domain' do
client = create(:client, provider: provider, symbol: ENV['MDS_USERNAME'], password: ENV['MDS_PASSWORD'], domains: "example.org")
subject = build(:doi, doi: "10.5438/mcnv-ga6n", url: "https://blog.datacite.org/", client: client, aasm_state: "findable")
expect { subject.register_url }.to raise_error(ActionController::BadRequest, "[Handle] Error updating DOI 10.5438/MCNV-GA6N: URL not allowed by client domains settings.")
expect { subject.register_url }.to raise_error(ActionController::BadRequest, "[Handle] Error updating DOI 10.5438/MCNV-GA6N: URL not allowed by repository domains settings.")
end

it 'wrong subdomain' do
client = create(:client, provider: provider, symbol: ENV['MDS_USERNAME'], password: ENV['MDS_PASSWORD'], domains: "datacite.org")
subject = build(:doi, doi: "10.5438/mcnv-ga6n", url: "https://blog.datacite.org/", client: client, aasm_state: "findable")
expect { subject.register_url }.to raise_error(ActionController::BadRequest, "[Handle] Error updating DOI 10.5438/MCNV-GA6N: URL not allowed by client domains settings.")
expect { subject.register_url }.to raise_error(ActionController::BadRequest, "[Handle] Error updating DOI 10.5438/MCNV-GA6N: URL not allowed by repository domains settings.")
end

it 'wildcard for subdomain but using naked domain' do
client = create(:client, provider: provider, symbol: ENV['MDS_USERNAME'], password: ENV['MDS_PASSWORD'], domains: "*.datacite.org")
subject = build(:doi, doi: "10.5438/mcnv-ga6n", url: "https://datacite.org/", client: client, aasm_state: "findable")
expect { subject.register_url }.to raise_error(ActionController::BadRequest, "[Handle] Error updating DOI 10.5438/MCNV-GA6N: URL not allowed by client domains settings.")
expect { subject.register_url }.to raise_error(ActionController::BadRequest, "[Handle] Error updating DOI 10.5438/MCNV-GA6N: URL not allowed by repository domains settings.")
end

it 'draft doi' do
Expand Down

0 comments on commit ed6a639

Please sign in to comment.