Skip to content

Commit

Permalink
Merge branch 'master' of github.com:datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Oct 16, 2019
2 parents be35b99 + 573d4b9 commit 5ba0d34
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def validate
def create
logger = Logger.new(STDOUT)
# logger.info safe_params.inspect
fail CanCan::AuthorizationNotPerformed unless current_user.present?

@doi = Doi.new(safe_params)

Expand Down
24 changes: 24 additions & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,30 @@
end
end

context 'when the request is valid no password' do
let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }
let(:valid_attributes) do
{
"data" => {
"type" => "dois",
"attributes" => {
"doi" => "10.14454/10703",
"url" => "http://www.bl.uk/pdf/patspec.pdf",
"xml" => xml,
"source" => "test",
"event" => "publish"
}
}
}
end

it 'fails to create a Doi' do
post '/dois', valid_attributes

expect(last_response.status).to eq(401)
end
end

context 'when the request is valid random doi' do
let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }
let(:valid_attributes) do
Expand Down

0 comments on commit 5ba0d34

Please sign in to comment.