Skip to content

Commit

Permalink
update base_resource_indexer coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rococodogs committed Jan 10, 2025
1 parent 6c4a743 commit ac7b790
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion spec/support/shared_examples/indexing/base_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
it_behaves_like 'it indexes', :related_resource, to: ['related_resource_tesim', 'related_resource_sim']
it_behaves_like 'it indexes', :resource_type, to: ['resource_type_ssim']
it_behaves_like 'it indexes', :rights_holder, to: ['rights_holder_tesim', 'rights_holder_sim']
it_behaves_like 'it indexes', :rights_statement, to: ['rights_statement_ssim']
it_behaves_like 'it indexes', :source, to: ['source_tesim', 'source_sim']
it_behaves_like 'it indexes', :source_identifier, to: ['source_identifier_ssim']
it_behaves_like 'it indexes', :subject, to: ['subject_ssim']
Expand Down Expand Up @@ -139,5 +138,45 @@
it { is_expected.to eq "#{url_host_value}#{thumbnail_path}" }
end
end

describe 'indexes rights_statement and label' do
let(:metadata) { { rights_statement: ['http://rightsstatements.org/vocab/InC-EDU/1.0/'] } }

it 'indexes the URI value' Do
expect(solr_document['rights_statement_ssim']).to eq ['http://rightsstatements.org/vocab/InC-EDU/1.0/']
end

it 'indexes the shortcode' do
expect(solr_document['rights_statement_shortcode_ssim']).to eq ['InC-EDU']
end

it 'indexes the label' do
expect(solr_document['rights_statement_label_ssim']).to eq ['In Copyright - Educational Use Permitted']
end
end

describe 'indexes citation metadata' do
let(:metadata) { { bibliographic_citation: ['Last, First. "Title." Journal 1.2 (2000): 1-2.'] } }

it 'indexes the citation fields' do
expect(solr_doc['citation_journal_title_ss']).to eq 'Journal'
expect(solr_doc['citation_volume_ss']).to eq '1'
expect(solr_doc['citation_issue_ss']).to eq '2'
expect(solr_doc['citation_firstpage_ss']).to eq '1'
expect(solr_doc['citation_lastpage_ss']).to eq '2'
end

context 'with incomplete metadata' do
let(:metadata) { { bibliographic_citation: ['Last, First. "Title." Journal 1.2 (2000)'] } }

it 'indexes what it can' do
expect(solr_doc['citation_journal_title_ss']).to eq 'Journal'
expect(solr_doc['citation_volume_ss']).to eq '1'
expect(solr_doc['citation_issue_ss']).to eq '2'
expect(solr_doc['citation_firstpage_ss']).to eq nil
expect(solr_doc['citation_lastpage_ss']).to eq nil
end
end
end
end
end

0 comments on commit ac7b790

Please sign in to comment.