Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Aug 27, 2018
2 parents 0507b52 + ad93079 commit 8e091f4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ We use Rspec for testing:
bundle exec rspec
```

Note when using a fresh test database you will need to instantiate the test db with:
```bash
bundle exec rake db:create RAILS_ENV=test
```


Follow along via [Github Issues](https://github.com/datacite/lupo/issues).

### Note on Patches/Pull Requests
Expand All @@ -42,4 +48,4 @@ Follow along via [Github Issues](https://github.com/datacite/lupo/issues).

## License

**Lupo** is released under the [MIT License](https://github.com/datacite/lupo/blob/master/LICENSE).
**Lupo** is released under the [MIT License](https://github.com/datacite/lupo/blob/master/LICENSE).
37 changes: 37 additions & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,43 @@
end
end

context 'when we transfer a DOI' do
let(:doi) { create(:doi, doi: "10.24425/119495", client: client, state: "registered") }
let(:new_client) { create(:client, symbol: "#{provider.symbol}.magic", provider: provider, password: ENV['MDS_PASSWORD']) }
let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }
let(:valid_attributes) do
{
"data" => {
"type" => "dois",
"attributes" => {
"url" => "http://www.bl.uk/pdf/pat.pdf",
"xml" => xml
},
"relationships"=> {
"client"=> {
"data"=> {
"type"=> "clients",
"id"=> new_client.symbol.downcase
}
}
}
}
}
end

before { put "/dois/#{doi.doi}", params: valid_attributes.to_json, headers: admin_headers }

it 'returns no errors' do
puts json
expect(response).to have_http_status(200)
expect(json.dig('data', 'attributes', 'doi')).to eq(doi.doi)
end

it 'updates the client id' do
expect(json.dig('data', 'relationships', 'client','data','id')).to eq(new_client.symbol.downcase)
end
end

context 'when the resource_type_general changes' do
let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }
let(:resource_type_general) { "data-paper" }
Expand Down

0 comments on commit 8e091f4

Please sign in to comment.