diff --git a/spec/api/api_spec.rb b/spec/api/api_spec.rb index 9e95b94..29b1154 100644 --- a/spec/api/api_spec.rb +++ b/spec/api/api_spec.rb @@ -544,6 +544,13 @@ expect(last_response.body).to start_with("M. Sankar, K. Nieminen") end + it "header with style software apa" do + doi = "10.21373/1572872428618" + get "/#{doi}", nil, { "HTTP_ACCEPT" => "text/x-bibliography; style=apa" } + expect(last_response.status).to eq(200) + expect(last_response.body).to eq("Miller, E. (2014). Full DataCite XML Example (Version 4.2) [Computer software]. DataCite. https://doi.org/10.21373/1572872428618") + end + it "header with style and locale" do get "/#{doi}", nil, { "HTTP_ACCEPT" => "text/x-bibliography; style=vancouver; locale=de" } expect(last_response.status).to eq(200) @@ -1052,6 +1059,13 @@ expect(last_response.status).to eq(200) expect(last_response.body).to eq("Ebihara, A., Nakato, N., Kuo, L.-Y., Miyazaki, H., & Serizawa, S. (2019). Allopolyploid Origin and Distribution Range of Acystopteris taiwaniana (Cystopteridaceae: Polypodiales). In Acta phytotaxonomica et geobotanica (Vol. 70, pp. 19–28). The Japanese Society for Plant Systematics. https://doi.org/10.18942/apg.201812") end + + it "link with style" do + get "/text/x-bibliography/#{doi}?style=ieee" + + expect(last_response.status).to eq(200) + expect(last_response.body).to start_with("A. Ebihara, N. Nakato") + end end context "unknown accept header" do diff --git a/spec/fixtures/vcr_cassettes/content_negotiation_crossref/text/x-bibliography/header_with_style_software_apa.yml b/spec/fixtures/vcr_cassettes/content_negotiation_crossref/text/x-bibliography/header_with_style_software_apa.yml new file mode 100644 index 0000000..d1cf129 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/content_negotiation_crossref/text/x-bibliography/header_with_style_software_apa.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.stage.datacite.org/dois/10.21373/1572872428618 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.6.1; mailto:info@datacite.org) + Accept: + - application/vnd.datacite.datacite+json + Accept-Encoding: + - gzip + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 24 Jun 2020 06:27:28 GMT + Content-Type: + - application/vnd.datacite.datacite+json; charset=utf-8 + Connection: + - keep-alive + Status: + - 200 OK + X-Anonymous-Consumer: + - 'true' + Cache-Control: + - max-age=0, private, must-revalidate + Vary: + - Accept-Encoding, Origin + Content-Encoding: + - gzip + Etag: + - W/"d3e177ecadf2cfe521e4aeec2fba63e5" + X-Runtime: + - '0.029754' + X-Request-Id: + - 2896ef99-c562-46c5-a1f3-553f682d9752 + X-Powered-By: + - Phusion Passenger 6.0.5 + Server: + - nginx/1.14.0 + Phusion Passenger 6.0.5 + body: + encoding: ASCII-8BIT + string: !binary |- + H4sIAFDy8l4AA9RYW2/bNhR+768Q/LroZidx3LfFabcMzgVxAnQY+kBJRzZbShRIyolT5L/3kLqYUhQn61YMM2DA4jk8l+9c5W/vHGdEk9F7Z7RWqpDvfT/h1ONi5YeBNw4n04kfHk3HJ9Px4fjkODwZHegbyKOv7GMpBbOlyngNGfESokhMFRgNGSjifwWRA3MPvcCneQIP3lplrBKhtgVIFPINH/BRUP0wml9dXBs6HkU0UvCgTzMq4+ZUKygEj/U5EYrGDBpSZcaVWGnakqfqnghY8lLEMOdJyyZAmrNbtEBzfrpYDJF+gxwEYbasEXI9GetjAURxoW3+y1yt3EBKTjIj9YIyBuLA+cDoI4lArWsdNUuj/BqE5DlhO+qKbiC/rKUM3E5JRtn2sqNmRyVpShklivK8tc22r2PjGQZsjniOWuJT/etzx9jzBHJFUwqWw8+EGvThTlA7M7iIaaLzobVwQOjgBT/Aj4vf0D2qf033CVka9VrU1c38/GzApXfN0+cqAaliMBBARnKTQJC7d8sdsIZdn38sGXMa5BxMHufDA8kKVqP4dPD3xJ1BxnOphAmZw9Od6GvBC8AMB+n17jXJsyyjSk7PtaKMGJXrCtk2yFXi8lwRmhvStyqXZRl9gVi9HYr6gqZgVJyYZ0WpQDgyppDHYDH2U0J3ILiHrUfzlPvPJO5iaLj6bm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