Skip to content

Commit

Permalink
Merge 240065d into 24d9a91
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 30, 2019
2 parents 24d9a91 + 240065d commit ec0c9fa
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
7 changes: 4 additions & 3 deletions .rubocop_todo.yml
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-04-29 12:10:56 -0500 using RuboCop version 0.65.0.
# on 2019-04-30 16:17:54 -0500 using RuboCop version 0.65.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -145,7 +145,7 @@ RSpec/EmptyLineAfterSubject:
Exclude:
- 'spec/models/symphony_reader_spec.rb'

# Offense count: 39
# Offense count: 40
# Configuration parameters: Max.
RSpec/ExampleLength:
Exclude:
Expand All @@ -155,6 +155,7 @@ RSpec/ExampleLength:
- 'spec/dor/goobi_spec.rb'
- 'spec/dor/service_item_spec.rb'
- 'spec/dor/update_marc_record_service_spec.rb'
- 'spec/requests/metadata_spec.rb'
- 'spec/services/dublin_core_service_spec.rb'
- 'spec/services/public_xml_service_spec.rb'
- 'spec/services/publish_metadata_service_spec.rb'
Expand Down Expand Up @@ -191,7 +192,7 @@ RSpec/MessageSpies:
- 'spec/services/registration_service_spec.rb'
- 'spec/services/version_service_spec.rb'

# Offense count: 77
# Offense count: 78
# Configuration parameters: AggregateFailuresByDefault.
RSpec/MultipleExpectations:
Max: 8
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/metadata_controller.rb
Expand Up @@ -8,4 +8,9 @@ def dublin_core
service = DublinCoreService.new(@item)
render xml: service
end

def descriptive
service = Dor::PublicDescMetadataService.new(@item)
render xml: service
end
end
1 change: 1 addition & 0 deletions config/routes.rb
Expand Up @@ -42,6 +42,7 @@
resources :metadata, only: [] do
collection do
get 'dublin_core'
get 'descriptive'
end
end

Expand Down
29 changes: 23 additions & 6 deletions spec/requests/metadata_spec.rb
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe 'Refresh metadata' do
RSpec.describe 'Display metadata' do
let(:user) { Settings.DOR.SERVICE_USER }
let(:password) { Settings.DOR.SERVICE_PASSWORD }
let(:basic_auth) { ActionController::HttpAuthentication::Basic.encode_credentials(user, password) }
Expand All @@ -13,10 +13,27 @@
allow(Dor).to receive(:find).and_return(object)
end

it 'returns the DC xml' do
get '/v1/objects/druid:mk420bs7601/metadata/dublin_core',
headers: { 'Authorization' => basic_auth }
expect(response).to be_successful
expect(response.body).to include '<dc:title>Hello</dc:title>'
describe 'dublin core' do
it 'returns the DC xml' do
get '/v1/objects/druid:mk420bs7601/metadata/dublin_core',
headers: { 'Authorization' => basic_auth }
expect(response).to be_successful
expect(response.body).to include '<dc:title>Hello</dc:title>'
end
end

describe 'descriptive' do
it 'returns the DC xml' do
get '/v1/objects/druid:mk420bs7601/metadata/descriptive',
headers: { 'Authorization' => basic_auth }
expect(response).to be_successful
expect(response.body).to be_equivalent_to <<~XML
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd">
<titleInfo>
<title>Hello</title>
</titleInfo>
</mods>
XML
end
end
end

0 comments on commit ec0c9fa

Please sign in to comment.