Skip to content

Commit

Permalink
Merge pull request #248 from samvera/loc_check
Browse files Browse the repository at this point in the history
determine is loc special processing should be done based on template uri instead of authority name
  • Loading branch information
Julie Allinson committed Jun 4, 2019
2 parents 4878012 + 7b36755 commit 7c24d4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/qa/authorities/linked_data/find_term.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def loc_id

# determine if the current authority is LOC which may require special processing of its ids for backward compatibility
def loc?
authority_name.to_s.casecmp('loc').zero?
term_config.url_config.template.starts_with? 'http://id.loc.gov/authorities/'
end

def expects_uri?
Expand Down
10 changes: 10 additions & 0 deletions spec/lib/authorities/linked_data/find_term_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@
it 'extracts correct uri when loc id does not have blank' do
expect(results_without_blank[:uri]).to eq 'http://id.loc.gov/authorities/subjects/sh85118553'
end

context 'when alternate authority name is used to access loc' do
let(:results) { lod_loc.find('sh 85118553', subauth: 'subjects') }

before { allow(lod_loc.term_config).to receive(:authority_name).and_return('ALT_LOC_AUTHORITY') }

it 'does special processing to remove blank from id' do
expect(results[:uri]).to eq 'http://id.loc.gov/authorities/subjects/sh85118553'
end
end
end
end

Expand Down

0 comments on commit 7c24d4b

Please sign in to comment.