spec/lib/spotlight/dor/indexer_spec.rb in spotlight-dor-resources-0.1.0 vs spec/lib/spotlight/dor/indexer_spec.rb in spotlight-dor-resources-0.2.0
- old
+ new
@@ -499,10 +499,11 @@
end # each
end # add_folder_name
# rubocop:enable Metrics/LineLength
describe '#add_object_full_text' do
+ let(:full_text_solr_fname) { 'full_text_tesimv' }
before do
allow(sdb).to receive(:bare_druid).and_return(fake_druid)
end
let!(:expected_text) { 'SOME full text string that is returned from the server' }
let!(:full_file_path) { 'https://stacks.stanford.edu/file/oo000oo0000/oo000oo0000.txt' }
@@ -525,11 +526,11 @@
allow(sdb).to receive(:public_xml).and_return(public_xml_with_feigenbaum_full_text)
# don't actually attempt a call to the stacks
allow(subject).to receive(:get_file_content).with(full_file_path).and_return(expected_text)
subject.send(:add_object_full_text, sdb, solr_doc)
expect(subject.object_level_full_text_urls(sdb)).to eq [full_file_path]
- expect(solr_doc['full_text_tesim']).to eq [expected_text]
+ expect(solr_doc[full_text_solr_fname]).to eq [expected_text]
end
it 'does not index the full text if no recognized pattern is found' do
public_xml_with_no_recognized_full_text = Nokogiri::XML <<-EOF
<publicObject id="druid:oo000oo0000" published="2015-10-17T18:24:08-07:00">
<contentMetadata objectId="oo000oo0000" type="book">
@@ -545,11 +546,11 @@
</publicObject>
EOF
allow(sdb).to receive(:public_xml).and_return(public_xml_with_no_recognized_full_text)
subject.send(:add_object_full_text, sdb, solr_doc)
expect(subject.object_level_full_text_urls(sdb)).to eq []
- expect(solr_doc['full_text_tesim']).to be_nil
+ expect(solr_doc[full_text_solr_fname]).to be_nil
end
it 'indexes the full text from two files if two recognized patterns are found' do
public_xml_with_two_recognized_full_text_files = Nokogiri::XML <<-EOF
<publicObject id="druid:oo000oo0000" published="2015-10-17T18:24:08-07:00">
<contentMetadata objectId="oo000oo0000" type="book">
@@ -568,9 +569,9 @@
EOF
allow(sdb).to receive(:public_xml).and_return(public_xml_with_two_recognized_full_text_files)
allow(subject).to receive(:get_file_content).with(full_file_path).and_return(expected_text)
subject.send(:add_object_full_text, sdb, solr_doc)
expect(subject.object_level_full_text_urls(sdb)).to eq [full_file_path, full_file_path]
- expect(solr_doc['full_text_tesim']).to eq [expected_text, expected_text] # same file twice in a 2 element array
+ expect(solr_doc[full_text_solr_fname]).to eq [expected_text, expected_text] # same file twice in a 2 element array
end
end # add_object_full_text
end