Skip to content

Commit

Permalink
Merge 358abef into 417c2e9
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Sep 10, 2019
2 parents 417c2e9 + 358abef commit c2c1d4a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
8 changes: 0 additions & 8 deletions spec/controllers/objects_controller_spec.rb
Expand Up @@ -88,14 +88,6 @@
end
end

describe '/update_marc_record' do
it 'updates a marc record' do
# TODO: add some more expectations
post :update_marc_record, params: { id: item.pid }
expect(response.status).to eq(201)
end
end

describe '/notify_goobi' do
let(:fake_request) { "<stanfordCreationRequest><objectId>#{item.pid}</objectId></stanfordCreationRequest>" }

Expand Down
21 changes: 21 additions & 0 deletions spec/requests/update_marc_record_spec.rb
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Update MARC record' do
let(:payload) { { sub: 'argo' } }
let(:jwt) { JWT.encode(payload, Settings.dor.hmac_secret, 'HS256') }
let(:object) { Dor::Item.new(pid: 'druid:1234') }

before do
allow(Dor).to receive(:find).and_return(object)
end

context 'when the request is successful' do
it 'returns a 201 response' do
post '/v1/objects/druid:1234/update_marc_record', headers: { 'X-Auth' => "Bearer #{jwt}" }

expect(response.status).to eq(201)
end
end
end

0 comments on commit c2c1d4a

Please sign in to comment.